執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>Regex Modifier: [0-5]</h1> <p>How many characters in the text "Call 555-2368" is a digit between "0" and "5":</p> <?php $txt = "Call 555-2368"; $pattern = "/[0-5]/"; 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>
正則表示式修飾符:[0-5]
在文字“Call 555-2368”中有多少個字元是介於“0”和“5”之間的數字?
5
匹配項在此處找到
Call ###-##68
(每次匹配都替換為“#”字元)