<html>
<body>
<h1>Regex Modifier: m</h1>
<p>How many times does the phrase "you" occur at the beginning of a line in the text:</p>
<pre>you are better than
you think</pre>
$txt = "you are better than\nyou think";
$pattern = "/^you/m";
echo preg_match_all($pattern, $txt);
<p>The matches were found here:</p>
<pre>
echo preg_replace($pattern, "#", $txt);
</pre>
<p>(Each match was replaced by a # character)</p>
</body>
</html>
How many times does the phrase "you" occur at the beginning of a line in the text:
you are better than you think2
The matches were found here:
# are better than # think
(Each match was replaced by a # character)