Restrict Possible Usernames : Regular Expression

let username = "JackOfAllTrades";
let userCheck = /$\d*{2,}^[a-z]/i; 
let result = userCheck.test(username);

Please check my code above, whats wrong in it ? Its not running.

Hi, can you give us more details?
What do you need to achieve?
What are the tests you need to pass?

Challenge Name: Restrict Possible Username

I have to pass the following points below in regular expression section.

  1. The only numbers in the username have to be at the end. There can be zero or more of them at the end.

  2. Username letters can be lowercase and uppercase.

  3. Usernames have to be at least two characters long. A two-letter username can only use alphabet letter characters.

Written like that you are imposing a ^ character in the middle of the username, I don’t think it is what you want

You can see how the regex break down using a tool like (there are many others)

1 Like

Plus this is a pattern error, you have two counters one after the other, you can have only one