Solved

Regular Expression Validation for Complex Passwords

Posted on 2011-09-16
2
371 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

726 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