執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>Regex Modifier: [^eo]</h1> <p>How many letters in the text "Welcome" are not "e" or "o":</p> <?php $txt = "Welcome"; $pattern = "/[^eo]/"; 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>
正則表示式修飾符:[^eo]
在文字“Welcome”中有多少個字母既不是“e”也不是“o”?
4
匹配項在此處找到
#e##o#e
(每次匹配都替換為“#”字元)