It seems like everything is covered yet, i am doing something wrong.
Not sure what.
Your code so far
let username = "JackOfAllTrades";
let userCheck = /\D\w*\d+/gi; // Change this line
let result = userCheck.test(username);
//Point 1
//\w [A-Za-z0-9_ alphanumeric.
//Point 2
//\D non-digits [^0-9] code starts with that.
//\d [0-9] digits i added the + to care for the several numbers. Code ends with it
//Point 3
//i ignores capitale letters
//Point 4
//w+ is alphanumeric i added the + to care for the several alphanumeric letters.
//g is added to cover repeat
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.
then, your regex will return true even for something like 9aaa33a because it finds the part aaa33 that satisfy the pattern
your regex doesn’t say anything about how the string should start or end
to finish, you will need something a bit more complex to pass this:
I see that makes scense the global flag would ignore the double letters.
[^] searches for patterns at the beginning of strings.
So I added that one this time as well.
let username = "JackOfAllTrades";
let userCheck = /[^A-Za-z0-9_ ]\D*\d+/i; // Change this line
let result = userCheck.test(username);