运行 ❯
获取您的
自有 PHP
服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>Regex Modifier: [T-e]</h1> <p>How many letters in the text "Welcome to W3Schools" are alphabetically between uppercase "T" and lowercase "e":</p> <?php $txt = "Welcome to W3Schools"; $pattern = "/[T-e]/"; 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>
正则表达式修饰符: [T-e]
文本 "Welcome to W3Schools" 中有多少个字母在字母表中介于大写 "T" 和小写 "e" 之间
6
匹配结果如下
##l#om# to #3S#hools
(每个匹配项都被替换为 # 字符)