Regular Expressions - Restrict Possible Usernames

Tell us what’s happening:
Hi, I need help as I have no idea why my 2 of the tests are failing.
Can someone plese help me find out why my egex is not filtering numbers in small usernames?

Your code so far

let username = "JackOfAllTrades";
let userCheck = /^[\D][a-z]|^[\D][a-z][\d]$/gi; // Change this line
let result = userCheck.test(username);

Your browser information:

Gecko/20100101 Firefox/107.0

Challenge: Regular Expressions - Restrict Possible Usernames

Link to the challenge:

Here is a regex tool that will help you

Change the tool’s setting to ECMAScript (that is JavaScript) and paste the regex pattern in the top field.

Then paste the failing test strings in the string area

This tool will explain your regex to you

Thank you! This is really helpful. Will definitly be using this.

1 Like

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