Restrict Possible Usernames - stuck at some point


First of all, sorry for bothering.

I really want to complete this challenge in this way but it seems I cannot pass 2 of the required strings and I am not sure why.

Can someone please explain me what am not taking into consideration, please?


Your code so far

let username = "JackOfAllTrades";
let userCheck = /^\D+[a-zA-Z]+$\d*/; // Change this line
let result = userCheck.test(username);

Your browser information:

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

Challenge: Restrict Possible Usernames

Link to the challenge:

these are the requirements, can you explain how each of those is satisfied by your regex?


Thank you for your response.

^\D - Username cannot start with one or more numbers. / part of no.2 requirement

[a-zA-Z]+ - Username letters can be one or more lowercase and uppercase. Usernames have to be at least two characters long. / requirement no.3 + part of requirement no.4 - but I think that my code does not meet the +2 character long part

$\d *- The only numbers in the username have to be at the end. There can be zero or more of them at the end. / part of requirement no.2

so you are trying to match a number after the end of the string
careful where you put the end of string symbol