Decrease Font Size
Increase Font Size
   BLOG

ASP.NET Password Strength Regular Expression

ASP.NET Password Strength Regular Expression |

ASP.NET Password Strength Validation with Regular Expressions |

ASP.NET Regular Expression Validator (Password Strength)|

ASP.NET Password Strength Expression

 

Shown below is the regular expression for password strength with n number of digits, upper case, special characters and at least 12 characters in length.

(?=^.{12,25}$)(?=(?:.*?\d){2})(?=.*[a-z])(?=(?:.*?[A-Z]){2})(?=(?:.*?[!@#$%*()_+^&}{:;?.]){1})(?!.*\s)[0-9a-zA-Z!@#$%*()_+^&]*$

Explanation:

(?=^.{12,25}$) -- password length range from 12 to 25, the numbers are adjustable

(?=(?:.*?[!@#$%*()_+^&}{:;?.]){1}) -- at least 1 special characters (!@#$%*()_+^&}{:;?.}) , the number is adjustable

(?=(?:.*?\d){2}) -- at least 2 digits, the number is adjustable

(?=.*[a-z]) -- characters a-z

(?=(?:.*?[A-Z]){2}) -- at least 2 upper case characters, the number is adjustable

Comments (2) -

  • Ashfaq

    12/29/2010 4:13:38 PM |

    Bryian it would very hard to remember these kind of passwords. First of all it's 12-25 then again it accepts 2 upper cases,atleast 2 digits,with one special character.

    It would be nice if we keep it to below ten with 1 upper case, 1 digit and 1 special character

  • movie

    2/18/2011 3:24:30 AM |

    Bryian it would very hard to remember these kind of passwords. First of all it's 12-25 then again it accepts 2 upper cases,atleast 2 digits,with one special character.

Add comment

Loading