How do the problems evaluate lookaheads?

Tell us what’s happening:

So the question asks for two look aheads and an array of password samples that must be tested and the code I have seems to satisfy all the criteria… I even used two lookaheads but the problem keeps telling me I need two lookaheads

Your code so far
let passRegex = /(?=^[A-Za-z]\w[^_]+(?=\d\d+)){6,}/;


let sampleWord = "astronaut";
let pwRegex = /(?=^[A-Za-z]\w[^_]+(?=\d\d+)){6,}/; // Change this line
let result = pwRegex.test(sampleWord);

Your browser information:

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

Challenge: Positive and Negative Lookahead

Link to the challenge:

that’s because you have one inside the other, when it doesn’t expect that

I see… so you cannot nest the lookaheads. i feel like with this problem using two lookaheads complicates it more but i guess that was the point

let passRegex = /^[A-Za-z]\w[^_]+(?=\d{2,})+(?=\w+){6,}/;

I also used this… it is not nested but the problem says i still need two lookaheads

one lookahead for the length requirement, the other for the type of characters

one thing to remember: lookaheads are zero-width, they don’t actually match characters, but a position (followed by the required characters), so using a counter after a lookahead does nothing