Click here to Skip to main content
12,296,833 members (63,436 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

24.2K views
7 bookmarked
Posted

ASP.NET Password Strength Regular Expression

, 5 Jan 2011 CPOL
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 (Senior)
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.

You may also be interested in...

Comments and Discussions

 
SuggestionUpdate - due to no XML encoding and missing chars Pin
Hunter Beanland7-Jan-14 14:00
memberHunter Beanland7-Jan-14 14:00 
GeneralRe: Update - due to no XML encoding and missing chars Pin
Bryian Tan24-Feb-14 17:26
memberBryian Tan24-Feb-14 17:26 
GeneralReason for my vote of 5 Good work! Pin
Abdul Quader Mamun5-Jan-11 17:53
memberAbdul Quader Mamun5-Jan-11 17:53 
Generalgood work! 5/5 Pin
Abdul Quader Mamun5-Jan-11 17:53
memberAbdul Quader Mamun5-Jan-11 17:53 
GeneralReason for my vote of 5 nice one Pin
vikas amin5-Jan-11 9:24
membervikas amin5-Jan-11 9:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.160525.2 | Last Updated 5 Jan 2011
Article Copyright 2011 by Bryian Tan
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid