How to match with regex all special chars except “-” in PHP?

前端 未结 3 1161
情话喂你
情话喂你 2020-12-31 10:20

How can I match all the “special” chars (like +_*&^%$#@!~) except the char - in PHP?

I know that \\W will match all the “s

3条回答
  •  感动是毒
    2020-12-31 11:03

    You can try this pattern

    ([^a-zA-Z-])

    This should match all characters that are not a-z and the -

提交回复
热议问题