Positive and Negative Lookahead Problem

My code is passing all the test except for:
Your regex should not match "8pass99"

My code:

let sampleWord = "astronaut";
let pwRegex = /(?!\d)(?=\w{5,})(?=\D*\d{2,})/; // 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/81.0.4044.129 Safari/537.36.

Challenge: Positive and Negative Lookahead

Link to the challenge:

You do not have anything in your regular expression that impose the matching of the whole string. The test method will return true if it finds a part of the string that satisfy the pattern, to do otherwise (for the whole string to match the pattern) you need to specify so. You have learned how to do it in one of the previous lessons.

Also, be aware that lookaheads will all match from the same position.

Once you have fixed that, click here to show second hint

\D*\d{2,} match zero or more non numbers followed by at least 2 numbers. Instead the challenge asks for at least two consecutive numbers but it never says that there can’t be numbers in the string before that.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.