Tell us what’s happening:
why this regex work /(?=\w{6})(?=\w*\d{2})/
and why not this work /(?=\w{5,})(?=\w*\d{2})/
can anybody explain
Your code so far
let sampleWord = "astronaut";
let pwRegex = /(?=\w{5,})(?=\w*\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/115.0.0.0 Safari/537.36 Edg/115.0.1901.188
Challenge: Regular Expressions - Positive and Negative Lookahead
Link to the challenge: