using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; public class Test { public static void Main() { var text = "Aaaa 50.05 bbbb 82.52 cccc 6.8888"; var pattern = @"\d+\.\d+"; var result = Regex.Replace(text, pattern, x => $"{Math.Round(Double.Parse(x.Value))}"); Console.WriteLine(result); } }