Restrict Possible Usernames trouble following along

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:

I went ahead and progressed onto the following challenges and noticed there are some techniques covered in the solution for this specific problem aren’t actually covered until after these subsequent challenges. Given that, I would like to request anyone who is able to move this particular lesson later into the curriculum please do so, so that students aren’t confused by the sudden introduction of the use of range or limits when using the match function (something that isn’t covered at the time of this challenge). I would still like an answer to my question, but reordering this particular challenge would be greatly appreciated afterward.

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Thank you.

you don’t need ranges to solve this, it is possible to do with what was showed till now

hint: a{2,} === aa+

this is satisfyed in general:
you have one character at the beginning [a-z] followed by (2 or more numbers OR 1 or more letters then 0 or more numbers) , in total your username is at least 3 or 2 characters long, depending on second character

this is satisfied by the fact that the username can’t have numbers if it is 2 characters long. notice above that a two characters username can only match the second part, so it can only be letter letter+ number*

This is still a little confusing to me. Tell me if I understood this correctly.
[a-z]+ means the function would look for a minimum of one occurrence, which would have been satisfied with [a-z] alone, but the “+” duplicates the feature which makes it essentially [a-z][a-z]? Since it’s technically “once or more”, I assume [a-z][a-z] is the minimum, and any more [a-z] tacked on at the end will also be satisfactory to the conditions set.

The asterisk means the match is satisfied with or without the qualifier, but if it catches any occurrence of it, it’ll return the result.

So a level-appropriate code I came up with is


I know the answer is right because I just ran it through the challenge, but I need to know if I understood the concept correctly. And if I have, could you also go ahead and edit the solution on the hints page to reflect the appropriate techniques that are limited to the concepts that have been covered up to this point? While I can see the current solution is more efficient with less code (a goal for programmers in large), it’s still confusing to see it in terms of curriculum organization. Plus, plenty of lessons in the past went through the pains of coding inefficiently for the sake of building up a knowledge base from the rudimentary to the more complex. I think it’s only fair that this remains consistent throughout, even in the hints page because guys like me rely on it for step-wise explanations of concepts if I ever get stuck…