I need a regex for the following pattern:
-
Total of 5 characters (alpha and numeric, nothing else).
-
first character must be a letter (
A,B, orConly) -
the remaining 4 characters can be number or letter.
Clarifcation: the first letter can only be A, B, or C.
Examples:
A1234is validD1234is invalid
EDIT: Grrr… edited regex due to new ‘clarification’ 🙂
EDIT: To explain the above Regex in English…
^and$mean ‘From start to finish’ (this ensures that the whole string must perfectly match)[A-C]means ‘Match eitherA,B, orC‘[a-zA-Z0-9]{4}means ‘Match 4 lower case letters, upper case letters, or numbers’