using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var strs = new List<string> {"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)", ""));
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7CnVzaW5nIFN5c3RlbS5UZXh0LlJlZ3VsYXJFeHByZXNzaW9uczsKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCSB2YXIgc3RycyA9IG5ldyBMaXN0PHN0cmluZz4geyJTb21lIFdvcmRzIDEgMiAzIDQiLCAiU29tZSBXb3JkcyBUaGF0IFNob3VsZCBub3QgYmUgcmVwbGFjZWQgMTIgOSAxMjMgNCAxMiIsICJ0ZXN0IDkgOCIsICJ0IGUgcyB0IDkgOCIsICJBbm90aGVyIDEyIDAwMCIgfTsKCQkgZm9yZWFjaCAodmFyIHRlc3QgaW4gc3RycykgCgkJIHsKCQkJQ29uc29sZS5Xcml0ZUxpbmUoUmVnZXguUmVwbGFjZSh0ZXN0LCBAIig/PD1cZClccysoPz1cZCkiLCAiIikpOwoJCSB9CgkJIAoJfQp9