using System; using System.Linq; using System.IO; using System.Text.RegularExpressions; public class Test { public static void Main() { string text = "The the quick brown fox 23jumps o65ver th66e lazy dog."; var VAL = 4; Console.WriteLine(Regex.Replace(text, @"\d+", m => $"{VAL * int.Parse(m.Value)}")); } }