Why the part after "|" seems not to work?

I’m trying to use the code below but when I remove the part after “|”, the results are exactly the same :confused:
Any thoughts on why?
Thanks in advance!

Your code so far

let username = "JackOfAllTrades";
let userCheck = /^[a-z][a-z]*|^[a-z][a-z]*\d*$/i; // Change this line
let result = userCheck.test(username);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Restrict Possible Usernames

Link to the challenge:

Because /^[a-z][a-z]*/ will always match anything that /^[a-z][a-z]*\d*$/ matches so you don’t really need the latter in this case. I think maybe you forgot something at the end of the former?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.