RegEx has always been my Achilles’ heel. I am writing web app, where user will input his identifier. I’m using RegexValidator to validate this input.
The identifier should be something like this:
TN-In-PL-KW-2012-1234
And this is how the identifier is built:
- first two letters are always
TN - followed by hyphen
- then two letters, that are either:
In,Te,YoorEt - hyphen
- two uppercase letters
- another hyphen
- another two uppercase letters
- hyphen
- four digits, that are a year, so something between 1970 and 2012 (I can ignore that as long as there are 4 digits)
- hyphen
- ordinal number that can have from 1 to 4 digits
Please help me writing RegEx to match this identifier.
Just as a comment, I recommend you Rubular if you want to improve your regex skills, it’s a simple and practical page to have in mind when you need to work with regex