<html>
<body>
<h1>正则表达式修饰符:i</h1>
<p>在文本 "W3School" 中,字母 s 出现了多少次(不区分大小写):</p>
$txt = "W3School";
$pattern = "/s/i";
echo preg_match_all($pattern, $txt);
<p>匹配到的位置如下:</p>
echo preg_replace($pattern, "#", $txt);
<p>(每个匹配项都被替换为 # 字符)</p>
</body>
</html>