<html>
<body>
<h1>正则表达式修饰符:m</h1>
<p>在以下文本中,短语 "you" 在行首出现了多少次:</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>匹配到的位置如下:</p>
<pre>
echo preg_replace($pattern, "#", $txt);
</pre>
<p>(每个匹配项都被替换为 # 字符)</p>
</body>
</html>