Regex pattern including all special characters

后端 未结 18 1581
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 09:18

I want to write a simple regular expression to check if in given string exist any special character. My regex works but I don\'t know why it also includes all numbers, so wh

18条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 09:46

    To find any number of special characters use the following regex pattern: ([^(A-Za-z0-9 )]{1,})

    [^(A-Za-z0-9 )] this means any character except the alphabets, numbers, and space. {1,0} this means one or more characters of the previous block.

提交回复
热议问题