Positive and Negative Lookahead I need help pls

Tell us what’s happening:

I really do not understand what \D*\d what it means

Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/77.0.126 Chrome/71.0.3578.126 Safari/537.36.

Link to the challenge:

As previous lessons should have shown, \d stands for “digit”, \D stands for “non-digit”, and * stands for “zero or more”. So \D*\d means “any number (including zero) of non-digits followed by a digit”. Hope that clears things up.

Regexes are pretty dense syntax, and getting used to them takes practice. I recommend http://regextester.com, pasting some text into the “test string” field, and trying out different regexes.

1 Like

i got it, thank you.