<html>
<body>
<h1>Regex Modifier: \S</h1>
<p>How many non-whitespace characters are in the text "W3Schools has been live since 1999"?:</p>
$txt = "W3Schools has been live since 1999";
$pattern = "/\S/";
echo preg_match_all($pattern, $txt);
<p>The matches were found here:</p>
echo preg_replace($pattern, "#", $txt);
<p>(Each match was replaced by a # character)</p>
</body>
</html>
How many non-whitespace characters are in the text "W3Schools has been live since 1999"?:
29The matches were found here:
######### ### #### #### ##### ####(Each match was replaced by a # character)