Regular Expressions - Restrict Possible Usernames

Tell us what’s happening:
With the following regex displays error message as ‘TypeError: userCheck.test is not a function’ . Can anyone correct me please?
Your code so far

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36

Challenge: Regular Expressions - Restrict Possible Usernames

Link to the challenge:

You have forward slashes in your regular expression that shouldn’t be there.

1 Like

Try to change /|/ by | (remove the slashes).

1 Like

Thank you very much :+1::blush::blush::blush:

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