- How does \d{2} ensure it is 2 consecutive numbers?
- Why does the solution say it’s (?=\w{5,}) but not (?=\w{6,})?
- Why does the solution say it’s (?=\D*) but not (?=\D+) when at least one non-number character has to appear?
Your code so far
js
let sampleWord = "bana12";
let pwRegex = /(?=\w{6,})(?=\D*\d{2})/; // Change this line
let result = pwRegex.test(sampleWord);
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead