Tell us what’s happening:
Hi guys, could you please tell me what are my errors so I can learn from them? Thanks! I’ll explain my code:
my RegEx: /(?=\w{5,})(^\d)(?=[0-9][0-9])/;
I divided my code in 3 parts because 3 were the conditions to pass the test:
(?=\w{5,}) //to match all alphanumeric characters with at least 5 characters in the password
(^\d) //to do not match passwords that begin with numbers
(?=[0-9][0-9]) //to match only passwords with 2 consecutive digits
Your code so far
let sampleWord = "astronaut";
let pwRegex = /(?=\w{5,})(^\d)(?=[0-9][0-9])/; // 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/84.0.4147.105 Safari/537.36
.
Challenge: Positive and Negative Lookahead
Link to the challenge: