My code now is
let sampleWord = "astronaut";
let pwRegex = /(?=\w{6})(?=\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);
var test = "8pass99";
console.log(pwRegex.test(test));
I saw some explanation here which was
Here the lookahead is expecting two or more consecutive digits. We have to also check for Zero or more character apart from number.
I don’t understand this explanation. I get it that the issue is on the second part
(?=\d{2})
Why do I “have to also check for Zero or more character apart from number”? I mean, it’s even checking for ZERO or more, meaning it’s optional. I still can’t see it.
Challenge: Regular Expressions - Positive and Negative Lookahead
Link to the challenge: