626 B
626 B
title |
---|
Restrict Possible Usernames |
Restrict Possible Usernames
Solution:
let username = "JackOfAllTrades";
let userCheck = /^[a-z]{2,}\d*$/i;
let result = userCheck.test(username);
Explain:
- The only numbers in the username have to be at the end.
\d$
There can be zero or more of them at the end.*
/\d*$/;
- Username letters can be lowercase and uppercase.
i
/\d*$/i;
- Usernames have to be at least two characters long.
{2,}
A two-letter username can only use alphabet letter characters.^[a-z]
/^[a-z]{2,}\d*$/i;