This is not possible with standard regex, but you can if you write a custom MatchEvaluator.
string str = "Today I have answered 0 questions on StackOverlow.";
string pattern = @"\w*?(\d)";
var result = Regex.Replace(str, pattern,
m => (int.Parse(m.Groups[0].Value)+1).ToString() );
Console.WriteLine(result);
Today I answered 1 question on StackOverlow.
source
share