執行 ❯
獲取您
自己的 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
(每次匹配都替換為“#”字元)