Tell us what’s happening:
how come this code below matches the “bana12” test?
when letters at first should be greater than 5?
the challenge itself dictates that!
Use lookaheads in the pwRegex
to match passwords that are greater than 5 characters long, do not begin with numbers, and have two consecutive digits.
(?=\w{6})
my code so far
let sampleWord = "astronaut";
let pwRegex = /^(?=\w{6})(?=\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/78.0.3904.108 Safari/537.36
.
Challenge: Positive and Negative Lookahead
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead