Regular Expression - Password Validation is not working
- by Kesavan
Hi,
I have to validate the password using regex.
The password rule is like at least 1 uppercase and at least 2 numeric.
It works fine except if the character comes at the end of the string.
The regular expression which i am using is
"^(?=.*\d.{2})(?=.*[A-Z].{1})(?=.*[@#$%^&+=].{2}).{8,12}$"
Rules:
minimum length = 8
minimum uppercase = 1
minimum numeric = 2
minimum special character = 1
It works for Test123$$, Test$123, TEST123$s, Test123$1, Test12$3 but it fails if the character specified comes at the end of the string like Test123$, Test$a12, Test12aa@, 123aa@@T.
Please let me know if there is any fix for this.