Solved

Regular Expression Validation for Complex Passwords

Posted on 2011-09-16
2
368 Views
Last Modified: 2012-08-13
Hi All,

Could anyone provide me with the regexp validation for the following string criterion:

Must be min of 10 characters; and
Must include 3 of the 4 character types -
    Upper case letters
    Lower case letters
    numerals
    special characters

Many thanks,

Rit
0
Comment
Question by:rito1
2 Comments
 
LVL 18

Accepted Solution

by:
Dennis Aries earned 500 total points
ID: 36549026
Nilang Shah has an example of almost exactly your question. He expects all four types to be present.

You can extend this expression using the 'or'-sign (|) to combine the separate expressions that include 3 of the 4 types.

Something like this will do :)


^.*(?=.{10,})(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$|^.*(?=.{10,})(?=.*\d)(?=.*[A-Z])(?=.*[@#$%^&+=]).*$|^.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[@#$%^&+=]).*$|^.*(?=.{10,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$
0
 
LVL 1

Author Closing Comment

by:rito1
ID: 36549145
Excellent, thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now