Tell us what’s happening:
Describe your issue in detail here.
My problem is that my regex are matching cases where there is an integer embedded between characters. I am having difficulty understanding why this is the case, and how I can write a regex that can account for it.
I would also like advice in simplifying my regex. I currently have a “|” operator to include a specific edge case where we have a username with 1 character followed by two integers, and I suspect there might be a single regex to account for all of these situations.
Your code so far
let username = "JackOfAllTrades"; let userCheck = /[a-z][a-z][a-z|\d]*$|[a-z]\d\d/i; // Change this line let result = userCheck.test(username);
Your browser information:
User Agent is:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
Challenge: Restrict Possible Usernames
Link to the challenge: