[RegEx] 007 not matching? (Restrict Possible Usernames)

Tell us what’s happening: I tested it on RegExr and it can match 007 just fine. Not sure why it’s not matching here… Would like some help, please. I am pretty bad at regex…

Your code so far


let username = "JackOfAllTrades";
let userCheck = /^[a-z]+?[a-z][0-9]*?$|^[0-9a-z][0-9]{2,}?$/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/86.0.4240.75 Safari/537.36.

Challenge: Restrict Possible Usernames

Link to the challenge:

Maybe you are misreading?
it says

Your regex should not match the string 007

Oh, right! Thanks. I did not see the rule “cannot start with numbers”… Fixed it now.

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