Link to home
Start Free TrialLog in
Avatar of Jacob L
Jacob LFlag for United States of America

asked on

Regex for validating password requirements

I need some regex help. I am currently using the following regex "^(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z])(?=.*[^a-zA-Z])\S{8,20}$" (without the quotes) to validate a password that would require an upper, lower and non-alpha character. I need regex to meet the following criteria:

The password contains characters from three of the following categories:

Uppercase letters
Lowercase letters
Base 10 digits (0 through 9)
Non-alphanumeric characters (special characters): (~!@#$%^&*_-+=`|\(){}[]:;"'<>,.?/) Currency symbols such as the Euro or British Pound are not counted as special characters for this policy setting.
Any Unicode character that is categorized as an alphabetic character but is not uppercase or lowercase. This includes Unicode characters from Asian languages.
SOLUTION
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

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
Avatar of Jacob L

ASKER

Thanks Terry!
So if I wanted to test without the unicode it would look something like this?

^((?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[\"\^\-\]\\~!@#$%&*_+=`|(){}[:;'<>,.?/])(?=.*[A-Z])(?=.*\d)(?=.*[\"\^\-\]\\~!@#$%&*_+=`|(){}[:;'<>,.?/])(?=.*[a-z])(?=.*\d)(?=.*[\"\^\-\]\\~!@#$%&*_+=`|(){}[:;'<>,.?/]))\S{8,20}$
ASKER CERTIFIED SOLUTION
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
Avatar of Jacob L

ASKER

Apologies I had a baby and been off for a couple weeks. The solutions helped. Thank you.