Regular Expressions - Positive and Negative Lookahead

Tell us what’s happening:

Describe your issue in detail here, I am not sure why is not working, I found the solution, but I think is not right, because I am limiting my password to be 6 charachters long:

// /(?=\w{5,})(?=\w*\d{2,})/ but why is false?
// /(?=\w{6})(?=\w*\d{2})/; solution

Your code so far

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

// /(?=\w{5,})(?=\w*\d{2,})/ but why is false?
// /(?=\w{6})(?=\w*\d{2})/;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0

Challenge Information:

Regular Expressions - Positive and Negative Lookahead

Welcome to the forum @estebanh33

The failing regex is looking for a minimum of two digits, while the other one is looking for two digits only.