Regular Expressions: Restrict Possible Usernames Problem

let username = "JackOfAllTrades";
let userCheck = /^[a-z]{2,}\d*$/i;
let result = userCheck.test(username);

Hey guys, I have made the challenge but I have one thing in my mind that I’m wondering.

let userCheck = /^[a-z]{2,}\d*$/i;

In here why we used \d* not the \d ? What is the reason of * character?

It matches 0 or more of the preceding token. In your case, 0 or more digits.

There is a perfect tool to handle regExps


You see in real time the effects, with due comments.
You can even write tests.
Definitely to recommand for beginners as for ninjas