Why isn't this lookahead working?

Why isn't this lookahead working?


Tell us what’s happening:

I don’t understand why my lookahead isn’t passing the “bana12” and “abc123” tests.

The first lookahead is checking to see if the string is at least 5 alphanumeric characters long and the second lookahead is checking to see if there are atleast 2 consectutive numbers. If both are met, it should return true, but it’s returning false. Why?

Thanks in advance.

Your code so far

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

Your browser information:

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

Link to the challenge:


can you look through this related post from a few days ago and see if the information shared there is enough to help?
(skip the first response by me which was incorrect)