Restrict Possible Usernames - { } and instruction confusion

So, the way I interpret the first and third rules together is that a username longer than two characters could actually begin with just one letter and then finish off with numbers (e.g. s8448) or even just be all numbers.

Because of that, I couldn’t get the answer. Now I’m wondering if their solution:

/^[a-z]{2,}\d*$/i

would satisfy a username such as my example. I can’t find a lesson about the squiggly brackets. If not, perhaps the instructions should be fixed to make that clearer. Unless I’m just too persnickety…

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

UPDATE: After continuing, I’ve learned that the lesson about the curly brackets comes a few lessons later. I’m not sure how I should go about alerting FCC to this…

Their solution is a mess. They also mentioned that letters can be capitalized if I’m not wrong - that also won’t work seeing the regex provided.

[CORRECTION] That’s a real life example why using -i flag in regex is a bad idea

But no system is perfect and reviewing the code and reporting issues is a big (if not bigger) chunk of learning process :wink:

1 Like

maybe it will not work with the case pointed out here, but it certainly works for capital letters.
do you know the i flag?

1 Like