RegEx Restrict Usernames

Tell us what’s happening:
I’m not sure why my code isnt passing the tests " Your regex should not match BadUs3rnam3", “Your regex should match Z97” and “Your regex should not match c57bT3”

Your code so far


let username = "JackOfAllTrades";
let userCheck = /^[A-Z][\d]*$|[A-Z{2}]/ig; // 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/87.0.4280.88 Safari/537.36.

Challenge: Restrict Possible Usernames

Link to the challenge:

the counter must go outside the character class, like this it mean a different thing than what you want

you can look the breakdown in a tool like regex101.com

When I change it to [A-Z]{2} it fails to match JO but when i put [A-Z{2}] it passes JO, im not sure why