Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的正则表达式是
/\?symfony=\w{32}("|')/
但是php将正则表达式作为一个字符串,我无法形成它,任何人都可以帮我解决这个问题。
用反斜杠转义;例如:
$regex = "/\?symfony=\w{32}(\"|')/";
The"被转义为:\"因为你用 . 定义了字符串"。
"
\"
inside ' ' use \'
' '
\'
'/\?symfony=\w{32}("|\')/'
inside " " use \"
" "
"/\?symfony=\w{32}(\"|')/"