I had a list of different formats for the string. When a string produces a string of something, the users must key-in the format of that particular string.
If the given string are
A-01-13A
(One alphabet, follow by dash, two numbers, follow by dash, two numbers, and one alphabet)
or
A-01-13
(One alphabet, follow by dash, two numbers, follow by dash, two numbers)
The user's key-in string is validated below:
B-13-99
B-14-11A
The user's key-in string is NOT validated below:
B-13-100
What is the best way to validate the given string using Regex or other methods in Javascript?