Hello guys I'm trying to match the following regex:
- Minimum characters: 8
- Maximum characters: 22
- Minimum uppercase letters: 1
- Minimum lowercase letters: 1
- Minimum digits: 2
- Special characters are allowed
- First character must be a letter
- Maximum consecutive identical characters: 2
I've manage to complete every condition but the consecutive ones with:
(?=^.{8,22}$)(?=(.*\d){2})(?=(.*[A-Z]))^[a-zA-Z].*$
Following the post RegEx No more than 2 identical consecutive characters and a-Z and 0-9 I've seen that the way of not matching exact characters is:
((.)\2?(?!\2))+
But I'm unable to mix them both and have the full matching result. The tries are being done here: https://regex101.com/r/94KaXO/1/ where the first string should match but not the second one.
Thanks in advance.