Regex Password complexity requires that any three
of the following four characteristics must be applied when creating or changing a password.
- Alpha characters - at least 1 upper case alpha character
- Alpha characters - at least 1 lower case alpha character
- Numeric characters - at least 1 numeric character
- Special characters - at least 1 special character
I am trying with the following code, but its not working for special characters
(?=^.{6,}$)((?=.*\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*
I want my regex to be validated against the following 4 cases
Match cases
- P@ssword
- Password1
- p@ssword1
- p@12345