Positive and Negative lookahead expression

Hi guys,why exactly is my code not passing???

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0

Challenge: Positive and Negative Lookahead

Link to the challenge:

Look again. You forgot to wrap {2} next to \d inside the brackets of (?=\D+\d), it shouldnt be wrapped outside.

thanks man got it all figured out

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.