Positive and Negative Lookahead Insufficient Testcases

Positive and Negative Lookahead Insufficient Testcases
0

#1

Tell us what’s happening:

I am new to RegEx but I think I’ve found deficiency in this challenge. You can pass this challenge even without completing one of two tasks you are given, which are to check if the string is more than 5 chars and whether it has two consecutive digits. There isn’t a testcase where the string contains only one digit .

Your code so far


let sampleWord = "babadsa1";
let pwRegex = /(?=\w{6,})(?=\D*\d\d)/; // correct one 
//let pwRegex = /(?=\w{6,})(?=\D*\d)/; // incorrect one
let result = pwRegex.test(sampleWord);
console.log(result);

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/positive-and-negative-lookahead


#2

yes this has been noted on the forum before. You can check the FCC github to see if an issue exists for this already.


#3

Thanks, I will check it out.