I made the following regular expression:
(\d{5}|\d-\d{4}|\d{2}-\d{3}|\d{3}-\d{2}|\d{4}-\d)
And it works. That is, it will correspond to a 5-digit number or 5-digit number, it has only 1 hyphen, but the hyphen cannot be a line or an end.
I would like a similar regular expression, but for a 25-digit number. If I use the same tactics as above, the regex will be very long.
Can anyone suggest a simpler regex?
Additional notes: I put this regular expression in an XML file that should be used by an ASP.NET application. I do not have access to .net code. But I suspect they will do something:
Match match = Regex.Match("Something goes here", "my regex", RegexOptions.None);
source share