Regex, every non-alphanumeric character except white space or colon

前端 未结 9 2119
醉梦人生
醉梦人生 2020-11-27 11:23

How can I do this one anywhere?

Basically, I am trying to match all kinds of miscellaneous characters such as ampersands, semicolons, dollar signs, etc.

9条回答
  •  情歌与酒
    2020-11-27 12:00

    [^a-zA-Z\d\s:]
    
    • \d - numeric class
    • \s - whitespace
    • a-zA-Z - matches all the letters
    • ^ - negates them all - so you get - non numeric chars, non spaces and non colons

提交回复
热议问题