Reputation: 13
I want to create an expression for password as below:
Regex for passwords that must contain 8 characters, start with 2 lower or uppercase letters, contain one special character *
and a 5-digit number.
E.g.: az*12345
*
;I have tried it with this pattern:
(?=(.*[^a-zA-Z]){2})(?=.*[*]{1})(?=(.*\d){5}).{8}$
However, it yields almost the same results as a regex above. It starts with any character but I want the exact above mentioned pattern. I know I am close to it. Please suggest me what I should do.
Upvotes: 1
Views: 4039
Reputation: 627082
If you wish to match just [2-letters]+[*]+[5-digits]
pattern, here is what you are looking for:
Upvotes: 2