Solved

Regular Expression Validation for Complex Passwords

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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…

705 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

18 Experts available now in Live!

Get 1:1 Help Now