Regular expressions : Did I find simplest solution?

<%= @topic_view.topic.title %>
<%= @topic_view.topic.average_rating %> <%= @topic_view.topic.posts.count { |p| !!p.custom_fields['rating'] } %>

Hi campers !!!
I’m in the regular expressions section. In the topic " Regular Expressions: Restrict Possible Usernames"
where the rules are

  1. The only numbers in the username have to be at the end. There can be zero or more of them at the end.
  2. Username letters can be lowercase and uppercase.
  3. Usernames have to be at least two characters long. A two-letter username can only use alphabet letter characters.

My solutions was

/^[a-zA-Z]./

When I opened the solution I saw this

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

All tests have passed with my solution. It must start a letter and must have any other second character.

What do you think about it.

Also : I never seen the brackets in regexes since this point and the solution here using {2,} . What is this ?

I think that one of the intended requirements is that there must be at least two letters followed by any combination of letters and numbers. Your pattern matches a letter followed by one character of any type.

The {2,} is a way of doing repetition. You don’t need to use this technique to solve this particular challenge. Whoever contributed that solution. It will be covered in a later lesson. Whoever contributed that solution either just happened to already know it, had done some research on regular expressions to solve the challenge, or contributed the solution when the curriculum was organized a little differently.

Hope İ can explain my question.