I am trying to use .NET Regex to check string input format. The string can be in the format
single digit 0-9 followed by
single letter A-Z OR 07 OR 03 or AA followed by
two letters A-Z
Values 0AAA, 107ZF, 503GH, 0AAAA are valid. The line with which I create my Regex is as follows:
"([0-9]{1})" +
"((03$)|(07$)|(AA$)|[A-Z]{1})" +
"([A-Z]{2})"
However, this does not confirm the lines in which the second member is one of 03, 07, or AA. During debugging, I removed the third member from the line used to build the regular expression, and found that the input lines of the form 103, 507, 6AA confirm ........
Any ideas why, when I then put the third term back in Regex, input strings like 1AAGM don't match?
Thanks tom
source
share