Hi,
I'm working on a program where I need to match a regular expression and a string. The string is pretty simple actually but I'm having problems with my current regex (I'm using the .net regex engine)
My current regular expression is "^[VvEeTtPp][^a-zA-Z0-9\s]\d{0,12}?$"
Now, the string I want to match always follows this pattern
- First a single letter (only letters allowed are V, E, P, T in either case)
- Then, a dash
- Finally from 4 to 12 digits.
There is a final restriction that is that the regex must match any substring that complies the rules (for example "V" or "E-" or "P-123")
The regex works fairly well, but it will accept things like "V--".
Could someone help me write a better expression??
Thanks