Spoiler alert: This contains the answer to the problem on https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead
Hello - I got the first part correct(?=\w{5,})
but couldn’t get the second part - my attempt was (?=\d{2})
.
So, I admitted defeat and looked at the solution.
But, I don’t understand the solution: (?=\D*\d{2})
Specifically, what the \D*
is doing.
I understand that \D
matches all non-numbers and that the *
matches characters that occur zero or more times, but I don’t see how this relates to the rest of the expression.
Could any one tell me?