<html>
<body>
<h1>Regex Modifier: \w</h1>
<p>How many alphatbetical or 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 alphatbetical or digit characters are in the text "W3Schools.com"?:
12The matches were found here:
#########.###(Each match was replaced by a # character)