I need a regular expression for a string like this:
ex. 1234-1234-12345
where the first two numbers must be between 01-18 and the whole string must be 15 characters long
example: 0511-xxxx-xxxxx.
I tried using [RegularExpression(@"^[0-9]{1,18}$",
ErrorMessage = "Invalid Id.")]
but it doesnt work, it even gives me an error that says ',' is missing.
Lets make it even easier, a numeric string 13 character long where the first two digits must be between 01-18.
Ex. 1234567890123
(I would prefer the first format but this one work too).
I don't know how to use Regex so if someone can kindly give me a link to somewhere I can learn I would very much appreciate it.
And, most importantly, if there is a better way to get around this without using Regex I would appreciate it as well.
Apparently, my request is a little unclear. What I want it that the first two digits (XXxx-xxxx-xxxxx) be 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18.