Hello everyone,
searched a bit on the forum but didnt’ find the same issue.
I am refering to this test
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames
This is the code I made up:
let username = "RegexGuru";
let userCheck = /[a-z][a-z]+\d*$/ig; // Change this line
let result = userCheck.test(username);
let res2=username.match(userCheck);
console.log(result);
console.log(res2);
This is the output of console.log(s)():
true
RegexGuru
When running the test in freeCodeCamp editor the RegexGuru match doesnt result matched:
// running tests
Your regex should match RegexGuru
// tests completed
Is my RegEx wrong ?
That said, to me the [a-z][a-z]+ pattern seemed really bad so wanted to check the “Get a Hint” link. There the pattern used above is replaced with {2,} which is not explained in the previous lessons. Am I blind or that should be explained before giving it as a Solution ?
Thanks