Restrict Possible Usernames / G

Tell us what’s happening:
Hello, i did this challenge but i really don’t get why the g flag is not correct here ? Can someone explain it to me ? thanks

Your code so far

let username = "JackOfAllTrades";
let userCheck = /^[a-z]{2,}\d*$/gi; // Change this line
let result = userCheck.test(username);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0.

Link to the challenge:

I’m no wizard here but it seems necessary because you only want one string and you are specifying the beginning and end.

Why does it cause it to fail? Beats me. When I type those same things into a regex tester with your regex, they pass. But for whatever reason it doesn’t work. Maybe someone smarter than me can figure it out. But I agree that g is probably redundant here.

numbers at the end are not neccessary
simply type /^[a-zA-z]{2}/

Is this the exact code that you passed with? Because this is what I get when I run it.

Your regex should match JACK
Your regex should match RegexGuru

So the global flag isn’t why this particular regex fails

try hope it works…and more readble