Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

ASP.NET Password Strength Regular Expression

, 5 Jan 2011
Rate this:
Please Sign up or sign in to vote.
ASP.NET Password Strength Regular Expression. Customize n numbers of upper case, digits, special characters.

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 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Bryian Tan
Software Developer
United States United States
I have over three years of experience working with Microsoft technologies. I have earned my Microsoft Certified Technology Specialist (MCTS) certification. I'm a highly motivated self-starter with an aptitude for learning new skills quickly.

Comments and Discussions

 
SuggestionUpdate - due to no XML encoding and missing chars [modified] PinmemberHunter Beanland7-Jan-14 14:00 
GeneralRe: Update - due to no XML encoding and missing chars PinmemberBryian Tan24-Feb-14 17:26 
GeneralReason for my vote of 5 Good work! PinmemberAbdul Quader Mamun5-Jan-11 17:53 
Generalgood work! 5/5 PinmemberAbdul Quader Mamun5-Jan-11 17:53 
GeneralReason for my vote of 5 nice one Pinmembervikas amin5-Jan-11 9:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 5 Jan 2011
Article Copyright 2011 by Bryian Tan
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid