javascript regex for special characters

前端 未结 12 813
囚心锁ツ
囚心锁ツ 2020-11-29 22:28

I\'m trying to create a validation for a password field which allows only the a-zA-Z0-9 characters and .!@#$%^&*()_+-=

I can\'t seem to

12条回答
  •  甜味超标
    2020-11-29 23:06

    There are some issue with above written Regex.

    This works perfectly.

    ^[a-zA-Z\d\-_.,\s]+$
    

    Only allowed special characters are included here and can be extended after comma.

提交回复
热议问题