Tell us what’s happening:
I think I can follow along most of what was provided in the solution for the “hint” section of this page, but I can’t figure out what part of the code addresses both halves of the final condition, that is, Usernames have to be at least two characters long. A two-character username can only use alphabet letters as characters.
Could someone explain how each of those two conditions is covered separately?
Your code so far
let username = "JackOfAllTrades";
let userCheck = /^[a-z]([0-9]{2,}|[a-z]+\d*)$/i;; // Change this line
let result = userCheck.test(username);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
.
Challenge: Restrict Possible Usernames
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/regular-expressions/restrict-possible-usernames