Regular Expressions - Restrict Possible Usernames

Tell us what’s happening:
Your regex should not match the string BadUs3rnam3
Your regex should match the string Z97

Your code so far

let username ="BadUs3rnam3";
let userCheck = /^[A-Z][A-Z]\d?/i; // Change this line
let result = userCheck.test(username);
console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 11; Nokia 3.4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Mobile Safari/537.36

Challenge: Regular Expressions - Restrict Possible Usernames

Link to the challenge:

Must all usernames have exactly two letters at the beginning?

Do you know what this is matching? There can be more than one number at the end of the username.

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