I have a regular expression right now that enforces a requirement on a password in my Java application.
I want to now modify this expression so it reflects this policy:
at least 7 characters contains characters in three or more of the following character classes:
(a-z), (A-Z), (0-9), (@#$,. )
and the character at the beginning or end do not count towards its character class.
Is this too complex for a regular expression? If not, how can I modify my existing to adhere to the new one?
Thanks
Here is my current:
String credPattern = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%,.]).{7,})";
pattern = Pattern.compile(credPattern);
Matcher matcher = pattern.matcher(pw);