THE TASK Use lookaheads in the pwRegex to match passwords that are greater than 5 characters long, and have two consecutive digits.
Shouldnt this first positive lookaround be: /(?=\w{6,})
instead of /(?=\w{6})
?
Not using the comma means that we would be looking for passwords exactly 6 characters long, correct? The task says to match passwords greater than 5 characters long, which would include 6, 7, 8 etc…, correct? Including the comma would include numbers greater than 6 and not just the number 6, correct?
let sampleWord = "astronaut";
let pwRegex = /(?=\w{6})(?=\w*\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0
Challenge: Regular Expressions - Positive and Negative Lookahead
Link to the challenge: