Regular expression for password complexity

后端 未结 1 1459
刺人心
刺人心 2020-12-18 11:11

I am trying to implement the enforcement of password complexity through regular expressions on both client (JavaScript) and server side (ASP.NET C#).

The rules are t

相关标签:
1条回答
  • try this regex here:

    ((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{8,40})
    
    (           # Start of group
      (?=.*\d)      #   must contains one digit from 0-9
      (?=.*[a-z])       #   must contains one lowercase characters
      (?=.*[A-Z])       #   must contains one uppercase characters
      (?=.*[@#$%])      #   must contains one special symbols in the list "@#$%"
                  .     #     match anything with previous condition checking
                    {8,40}  #        length at least 8 characters and maximum of 40 
    )       
    
    0 讨论(0)
提交回复
热议问题