I have built a regular expression for password policy match, but it is not working as expected
/((?=.\d)(?=.[a-z])(?=.[A-Z])(?=.[@#\$%!])(?!(.)*\1{2,}).{6,20})/
Password must satisfy below rules
-> must have 1 digit
-> must have 1 upper case letter
-> must have 1 lower case letter
-> must have 1 special character from given list
-> minimum 6 character long
-> maximum 20 character long
-> Not more than 2 identical characters`
So it matches
aDm!n1, Adw1n@
but it must not match below aaaD!n1, teSt@111
I have searched for this regular expression and found "(?!(.)*\1{2,})" is not working properly
I am not getting why it is not working even though it has lookahead negative assertion.
Thanks in advance