Question: Use lookaheads in the pwRegex to match passwords that are greater than 5 characters long and have two consecutive digits.
Answer:
let sampleWord = "astronaut";
let pwRegex = /(?=\w{5,})(?=\D*\d{2})/;
let result = pwRegex.test(sampleWord);
Can anyone please explain why \D* is used in the second look-ahead ? What does it do exactly ?