Regex - With Space and Special Characters

后端 未结 5 1245
臣服心动
臣服心动 2020-12-22 02:49

I\'m using the following Regex ^[a-zA-Z0-9]\\s{2,20}$ for input

  • Letters A - Z
  • Letters a - z
  • Numbers 0 - 9

The inp

5条回答
  •  囚心锁ツ
    2020-12-22 03:01

    *** Regex for all types of special characters and normal characters too with space in between them.

    Declare the below in some variable and perform your task:

    /^[a-zA-Z0-9 !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]{2,20}$/
    

    *** Regex for all types of special characters with spaces:

    /^[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]{2,20}$/
    

    (answer is tried and tested!!)

提交回复
热议问题