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