I hope maybe this can help you or anyone else reading:
The brackets are character sets, which can be sets of letters or numbers, among other things. [a-z] = every letter of the alphabet lowercase, [a-zA-Z] = every letter of the alphabet caps and lowercase.
/^[a-z]([0-9]{2,}|[a-z]+\d*)$/i can be broken down like:
^ = starts with [a-z] = any letter a through z (lowercase) ()$ = ends with a match to one of the following in the capturing group [0-9]{2,} = 2 or more numbers | = or [a-z]+ = 1 or more letters a through z (lowercase) and \d* = 0 or more digits i = ignore case flag.
if we break the regex down further to very plain english:
the string must start with a letter AND end with 1 of the following: 2 or more numbers OR 1 or more letters and 0 or more numbers.
To solve the problem, it needs to be more like:
Starts with 2 or more letters and ends with 0 or more numbers OR starts with 1 or more letters and ends with 2 or more numbers. Don’t forget to keep the ignore case flag