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.
我想在我的 php preg_match 函数调用中允许括号:
preg_match("/[^A-Za-z0-9-_,#@. \/']/",$address).
如何才能做到这一点?
您应该使用反斜杠转义括号:
preg_match("/[^A-Za-z0-9-_,#@. \/'\[\]]/",$address);
你可以试试这个:
preg_match("/[^A-Za-z0-9-_,#@. \/\(\)']/", $address).
preg_match("/[^A-Za-z0-9-_,#@. /'\[\]]/",$address)