Tell us what’s happening:
The challenge provides the following constraints for the userCheck regular expression to fit :
1. Usernames can only use alpha-numeric characters.
2. The only numbers in the username have to be at the end. There can be zero or more of them at the end.
3. Username letters can be lowercase and uppercase.
4. Usernames have to be at least two characters long. A two-character username can only use alphabet letters as characters.
These constraints do not require that the first character be alphabetic if the number of characters is greater than two. Therefore, userCheck should match “007”.
Your code so far
let username = "JackOfAllTrades"; let userCheck = /^[a-z][a-z]+\d*$|^[a-z]\d\d+$|^\d\d\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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.
Challenge: Restrict Possible Usernames