fork(2) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text.RegularExpressions;
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. 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" };
  10. foreach (var test in strs)
  11. {
  12. Console.WriteLine(Regex.Replace(test, @"(?<=\d)\s+(?=\d)", ""));
  13. }
  14.  
  15. }
  16. }
Success #stdin #stdout 0.04s 134592KB
stdin
Standard input is empty
stdout
Some Words 1234
Some Words That Should not be replaced 129123412
test 98
t e s t 98
Another 12000