Solved

Regular Expression Validation for Complex Passwords

Posted on 2011-09-16
2
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

718 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