运行 ❯
获取您的
自己的 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
(每个匹配都用 # 字符替换了)