Restrict Possible Usernames - Simplify Solution

Tell us what’s happening:
So when I first went to solve this problem, I had the the following solution:

Your code so far


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

That regex solution passes the given tests, but it doesn’t pass for an edge case like a username of “a96” or any other three character username ending in two numbers. The challenge only states that two character usernames cannot contain numbers, not that each username had to start with 2 non-number values.

The solution I came up with is this, but I want to know if it could be simplified:


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

I appreciate all help in advance

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames