Why isn't this working?

I don’t understand why the code below isn’t working! ( Positive and Negative Lookahead challenge).
Here is the question:
Use lookaheads in the pwRegex to match passwords that are greater than 5 characters long, do not begin with numbers, and have two consecutive digits.
My answer:
/^\D(?=\w{5,})(?=\d{2,})/gi
Then I thought maybe I have to add \W* to the code in case a password contained * - … but nothing really changed. Can someone help me figure it out? (btw I saw the solution, and I don’t understand the difference between it and my code). thanks.

Since someone kindly shared this with me yesterday, I’m going to offer a Regex Tester resource. You might find this very helpful for understanding your code.

1 Like