VBobCat
Well-known member
I have to test a string that must match this pattern: any number of digits, a slash, and two or four digits, but not three (it is a year). So I'm using this boolean expression:
Here is my question: is there a way to test for two or four digits, but not three, in a single RegEx pattern?
Thank you very much!
System.Text.RegularExpressions.Regex.IsMatch(texto, "^\d+/\d{2,4}$") And Not System.Text.RegularExpressions.Regex.IsMatch(texto, "^\d+/\d{3}$")
Here is my question: is there a way to test for two or four digits, but not three, in a single RegEx pattern?
Thank you very much!