Tell us what’s happening:
This regex matches all the conditions mentioned in the challenge except for these two:
- Your regex should not match the string
BadUs3rnam3
- Your regex should not match the string
J%4
Can these two conditions be met without changing the regex I have written so far? If so, please tell what needs to be added to meet the conditions.
Your code so far
let username = "JackOfAllTrades";
let userCheck = /^\w\D|^[A-Z]\d\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/102.0.5005.115 Safari/537.36
Challenge: Restrict Possible Usernames
Link to the challenge: