Restrict Possible Usernames hacked :v or just a bug

Tell us what’s happening:
Well, first at all excuse my English, i’m not a native speaker.
I was doing this challenge, and result that my solution was right, but it isn’t

One of the rule is: The only numbers in the username have to be at the end. There can be zero or more of them at the end.

But my code solution was /[a-z]\w+/i; and it actually admits something like Master01Pro

So i think that this particular challenge need one more test to test something with numbers between the letters

Pff i hope i explained right

pd. right solution: /^[a-z]{2,}\d*$/i;

Your code so far


let username = "JackOfAllTrades";
let userCheck = /[a-z]\w+/i; // Change this line
let result = userCheck.test(username);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0.

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

@cybcova The current production version of this challenge does not have adequate tests, but more tests have been added which we are waiting to be deployed soon.

Your “right solution” would not pass the new tests, because a valid username (based on the challenge instructions is Z97 and your regex would not match it.

1 Like

Thanks :smiley: good to know