Tough Regex issue
I need to create a single regex (with .NET 3.5 Regex, if that matters)
that allows for all three of the following possibilities:
[A-Z]{2,3}
[A-Z]{2,3}-[A-Z][A-Z0-9]{1,2}
[A-Z]{2,3}-[A-Z][A-Z0-9]{1,2}-[A-Z0-9]{2,3}
So BIG, BIG-A9, or BIG-A09-SD would match, but BIG-F, BIG-A9S-, or
BIG-A09-S would NOT match.
I am pulling my hair out (what little is left).
Does someone out there know how to express this in a way that will work?
Thanks in advance!
No comments:
Post a Comment