I want to validate a string of variable length - a VIN number. I want to ensure that it contains only alphanumeric characters and is between 9 and 15 digits in length. However, I also want to make sure that nowhere in the string is a sequence of six or more alphanumeric characters. I am using .NET's regex engine.
00THZY7564TTX --> should pass validation
X0000000TEVBV --> should fail validation
I've looked at a number of posts, but I can't seem to get it down 100%. Currently, I have
(?<!(0){5,}.*)(?!.*(0){5,}.*)[A-Za-z0-9]{1,}
but it seems to ignore the zeros in the string (in example #2 above, it matches the 0000TEVBV
portion).
What am I doing wrong?
Thanks in advance!!