Can anybody help me understand the solution? How will you express the solution in words if you have to?

Tell us what’s happening:
Describe your issue in detail here.

Your code so far


let sampleWord = "astronaut";
let pwRegex = /(?=\w{6})(?=\w*\d{2})/g; // 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/92.0.4515.107 Safari/537.36

Challenge: Positive and Negative Lookahead

Link to the challenge:

Never Mind Just watched Beau’s tutorial . :laughing:

there should be at least 6 alphanumeric characters

and there should be two consecutive digits somewhere in the string - the \w* in front is to make sure that the digits can be anywhere, if it was just (?=\d{2}) they could have been only at the beginning

1 Like