Do not understand the userCheck answer

Tell us what’s happening:

I know in the previous lessons freecodecamp mentioned the A-Z 0-9 comment. How is that the answer and why didn’t the current question mention how to figure that out?? What is the purpose of letter d , *, and $

Your code so far


let username = "JackOfAllTrades";
let userCheck = /^[a-z][a-z]+\d*$|^[a-z]\d\d+$/i; // 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/89.0.4389.90 Safari/537.36 Edg/89.0.774.63.

Challenge: Restrict Possible Usernames

Link to the challenge:

Hi @dan.dan012 !

\d is the same as [0-9]
It was covered in this lesson.

The * matches character that happen zero or more times.

$ searches for patterns at the end of the string.

Hope that helps!

1 Like

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