I want to do a regex replace in C# dot net, and I want to know how many replacements were made. What is the best way?
The best I can do now is to look at the before/after to see if anything changed
var a = "gooodbaaad";
var b = Regex.Replace(a,"[oa]","x");
if (a != b) Debug.Write("changed");
but this seems rather indirect and not accurate in all cases.