troubleshooting Question

Need help with a RegEx to test a password field for character complexity

Avatar of erlythornton
erlythornton asked on
JavaScriptRegular Expressions
3 Comments1 Solution316 ViewsLast Modified:

I am working with a Javascript that in tandem with a javascript password generation script will test the result of the script for some complexity.

The password has to contain 2 numbers, 2 caps, 2 lowercase.   It also has to be 8 characters long. It does not matter what order they come in.  

I was trying this RegEx expression:  var expressionCheck = '^(?=.*[A-Z]{2})(?=.*[a-z]{2})(?=.*[0-9]{2}).{8,}$';

It does not appear to match anything.  If I take the {2} out it will match 1 of each.  

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros