Link to home
Start Free TrialLog in
Avatar of spazjr01
spazjr01Flag for United States of America

asked on

Search for 2 or more items in password validation using regular expression.

I am using Angular-JS and have the following expression, which checks a password input for 1 upper case letter, 1 lower case letter, 1 number, and one special character.  However, I need it to check for 2 or more upper case letters, 2 or more lower case letters, 2 or more numbers, and 2 or more special characters.  How do I modify the below expression to check for two or more instead of one or more?



ng-pattern="/^(?=^.{10,30}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{":;'?/>.<,])(?!.*\s).*$$/"
Avatar of BigRat
BigRat
Flag of France image

This gets very difficult since the expression no longer remains regular (technically it becomes a context grammar). I would simply write it in Javascript.
ASKER CERTIFIED SOLUTION
Avatar of louisfr
louisfr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial