Positive and Negative Lookahead
Can someone explain how the below regex expression enforces a “password” to more than 5 characters with 2 consecutive digits? It also restricts the password from starting with digits, but I understand the ^\D part. The lookahead confuses me because \w{5} makes it seem like the password has to be exactly 5 characters (not more than). I’m also confused by the latter lookahead \w*\d{2} which reads “any number of characters followed by exactly 2 digits”. Is the ‘\w*’ necessary since the beginning already enforces that it can’t start with a digit?
/^\D(?=\w{5})(?=\w*\d{2})/