Restrict Possible Usernames stuck on it

Tell us what’s happening:

Hello guys I am totally lost here, I have been reading about this a bit and I still dont get it.

Your code so far


let username = "JackOfAllTrades";
let userCheck = /^[a-z]\d$/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:84.0) Gecko/20100101 Firefox/84.0.

Challenge: Restrict Possible Usernames

Link to the challenge:

what is it that you do not get?

what I don’t get is why is not working

Usernames can only use alpha-numeric characters.

[a-z]
The only numbers in the username have to be at the end. There can be zero or more of them at the end. Username cannot start with the number.
\d$
Username letters can be lowercase and uppercase.
/i
Usernames have to be at least two characters long. A two-character username can only use alphabet letters as characters.

I have no idea what is being asked here

your regex will match only a two character string with first character letter second character number

OK, I guess i will do more search on it to see how can I do this, thanks

Tell us what’s happening:

Hey guys it’s me again but this time I really believe I have done it correctly but it just not going through, I used console.log to determine if what I have done was correctly or incorrectly and the result, I got is true but the test still said that doesn’t match, I have no idea of what else needs to be done here. Any help would be appreciated it.

Your code so far


let username = "AB1";
let userCheck = /^[a-z]+\d+\d$|^[a-z][a-z]+\d$|^[a-z]+/ig; // 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; rv:84.0) Gecko/20100101 Firefox/84.0.

Challenge: Restrict Possible Usernames

Link to the challenge:

do not use the g flag with the test method, see documentation for more infos on that