Assume I have the string:
10,11,12,13,14,ABC,DEF,GHI,66
I am looking to run a regex against it to only return 0-9 and the "," characters, essentially stripping anything else out.
I have looked at Regex.Replace, but something isn't quite right with it. My code below:
Regex reg = new Regex(@"[0-9,]+");
string input = reg.Replace(input, delegate(Match m)
{
return String.Empty;
});
How can I make this work?
string input = reg.Replace(input, "");(orString.Emptyif you like it better). It is very curious you've found the callback variation before a simple string replace...10,11,12,13,14,66so removingABC,DEF,GHI,