Restrict Possible Usernames1

Tell us what’s happening:

Why does this pass the test when it should be something like :
/^[a-z]{2,}\d*$/i;

did i miss a lesson where it explains the curly brackets?.. I understand the code, but still little confused

Your code so far


let username = "JackOfAllTrades";
let userCheck = /[^0-9]/gi; // Change this line
let result = userCheck.test(username);
console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames

The solution with curly braces is one way to solve it, but not the only way. They are explained in the challenges “Specify Upper and Lower Number of Matches” and “Specify Only the Lower Number of Matches”

1 Like

I continued with the lessons and low and behold. The curly brackets have appeared haha… Thanks for the quick response.