執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>Regex Modifier: \u</h1> <p>How many occurences of the digit "9" are in the text "W3Schools has been live since 1999"?:</p> <p>Use the hexadecimal equivalence of 9 which is 0039.</p> <?php $txt = "W3Schools has been live since 1999"; $pattern = "/\u{0039}/"; 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>
正則表示式修飾符:\u
在文字“W3Schools has been live since 1999”中有多少個數字“9”?
使用 9 的十六進位制等價物,即 0039。
3
匹配項在此處找到
W3Schools has been live since 1###
(每次匹配都替換為“#”字元)