using System; using System.Linq; using System.Collections.Generic; using System.Text.RegularExpressions; public class Test { public static void Main() { var strs = new List {"Some Words 1 2 3 4", "Some Words That Should not be replaced 12 9 123 4 12", "test 9 8", "t e s t 9 8", "Another 12 000" }; foreach (var test in strs) { Console.WriteLine(Regex.Replace(test, @"(?<=\d)\s+(?=\d)", "")); } } }