i trying to create a regular expression for this pattron
field-122 <--the number could be into 0 to 999
I develop this regular expression
Regex.Replace(htmlString, "field-*([0-9]|[1-9][0-9]|[1-9][0-9][0-9])", "|", RegexOptions.Singleline);
But fails when the numbers it’s with more that 2 digits. What’s wrong in the expression
Try this one on for size
If C# regexes don’t support the curly brace syntax, this should also work.
If you want arbitrarily long numbers, you can use
For reference,
?means zero or one,+means one or more, and{n,m}means at least n and at most m.