运行 ❯
获取您的
自有 PHP
服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>Regex Modifier: o{3,}</h1> <p>How many occurences of at least 3 preceeding o's (ooo) are in the text "W3Schools is goooooood"?:</p> <?php $txt = "W3Schools is goooooood"; $pattern = "/o{3,}/"; echo preg_match_all($pattern, $txt); ?> <p>The matches were found here:</p> <?php echo preg_replace($pattern, "#", $txt); ?> <p>(Each match was replaced by a # character)</p> </body> </html>
正则表达式修饰符:o{3,}
文本 "W3Schools is goooooood" 中至少有 3 个连续的 o (ooo) 出现了多少次?
1
匹配结果在这里
W3Schools is g#d
(每个匹配项都替换为 # 字符)