Restrict Possible Usernames tests not passing

Restrict Possible Usernames tests not passing
0

#1

Under my own testing on Regex101.com this passes the tests so not sure what I am doing wrong.

To explain, first group is looking for an alpha char string of 2 or more chars
2nd group is looking for an alpha char string of 2 or more chars ending in a digit
3rd group is looking for an alpha char string of 2 chars exactly

It is currently failing on
Your regex should match JACK
and
Your regex should match RegexGuru


let username = "JackOfAllTrades";
let userCheck = /^[A-Za-z]{2}.+|^[A-Za-z]{2}.+\d$|^[A-Za-z]{2}/g; // Change this line
let result = userCheck.test(username);

Browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/67.0.3396.99 Chrome/67.0.3396.99 Safari/537.36.

link to challenge


#2

Remove the g flag.