Tell us what’s happening:
Hi, I only wanted to say that I think that the objective is a little bit ambiguous, because at first I thought that passwords were required to have 2 consecutive digits only at the end of them (my code is the clear example of that), so then I had problem matching “astr1on11aut”, which is required for the test.
So, I would simply suggest to specify that passwords are required to have at least 2 consecutive digits.
Thank you!
Ps: I don’t know if this is the right place to post this, so I apologize if I made a mistake.
Your code so far
let sampleWord = "banana12";
let pwRegex = /^\D(?=\w{5,})(?=\D*\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; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 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#