What i am trying to match is like this :
char-char-int-int-int
char-char-char-int-int-int
char-char-int-int-int-optionnalValue (optionalValue being a "-" plus letters after it
My current regep looks like this :
([A-Za-z]{1,2})([1-9]{3})("-"[\w])
In the end, the regexp should match any of these:
- AB001
- aB999
- Hm000
- en789
- rv005-ab
These should be invalid:
- ab (because only letters)
- abcfr (because too much letters)
- 158 (because only numbers)
- 78532 (because too much numbers)
- 123ab (because all letters should come before numbers, optionalValue exepted)
- a1b23 (because letters and numbers are mixed)
What am i doing wrong ? (please be gentle this is my first post ever on stackoverflow)