<html>
<body>
<h1>Regex Modifier: \W</h1>
<p>How many non-alphatbetical and non-digit characters are in the text "W3Schools.com"?:</p>
$txt = "W3Schools.com";
$pattern = "/\W/";
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-alphatbetical and non-digit characters are in the text "W3Schools.com"?:
1The matches were found here:
W3Schools#com(Each match was replaced by a # character)