What’s happening:
I reached to a different solution. It passed all tests, but I would like it to be reviewed.
My code so far
let username = "JackOfAllTrades";
let userCheck = /^[a-z][a-z]*([a-z]|\d\d)\d*$/i;
let result = userCheck.test(username);
Challenge Information:
Regular Expressions - Restrict Possible Usernames
First of all, great job on solving this. There is no one right answer here. There are multiple ways to solve this.
This seems messy to me. The middle [a-z]
can definitely be removed.
Thank you @bbsmooth .
You are right, this way is clearer:
let userCheck = /^[a-z]+([a-z]|\d\d)\d*$/i;
1 Like
system
Closed
4
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.