Pos and Neg Lookahead Challenge

So I’m having trouble understanding why the first paren needs \w* ahead of the \d{2}. The best explanation I can think of is it shows that the two digits may not be the first ones to appear in the username. But doesn’t the ^\D at the beginning of the regex do that? I wrote the right expression except for that one pesky \w* - what purpose does it serve there?


let sampleWord = "astronaut";
let pwRegex = /^\D(?=\w*\d{2})(?=\w{5,})/; // Change this line
let result = pwRegex.test(sampleWord);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36.

Challenge: Positive and Negative Lookahead

Link to the challenge: