运行 ❯
获取您
自己的 PHP
服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>Regex Modifier: [A-Z]</h1> <p>How many letters in the text "Welcome to W3Schools" are alphabetically between uppercase "A" and uppercase "Z":</p> <?php $txt = "Welcome to W3Schools"; $pattern = "/[A-Z]/"; 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>
正则表达式修饰符:[A-Z]
在文本“Welcome to W3Schools”中有多少个字母按字母顺序排在(不含)大写字母“A”和(不含)大写字母“Z”之间?
3
匹配项在此处找到
#elcome to #3#chools
(每次匹配都替换为“#”字符)