I don't understand what is wrong

Tell us what’s happening:
Describe your issue in detail here.
So I don’t understand why this won’t work and don’t really have another idea right now I am hoping there could be a change done to fix this
the only one I can’t get are regex shouldn’t match the string BadUs3rnam3 and, should match string Z97

Your code so far


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

Your browser information:

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

Challenge: Restrict Possible Usernames

Link to the challenge:

Have you looked at your regex through an interactive editor? I like regexr.com, but there are a number of good ones. They’ll let you see what each part of it is doing.

I’m particularly curious what it says about you $ placement…

1 Like