fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4. using System.Linq;
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var pat = @"(?m)(?:(\A)|^(?!\A))(.*\b\s+(\d+)\r?\n)";
  10. var s = @"10 25
  11. 32 44
  12. 56 88
  13. 102 127
  14. 135 14510 25
  15. 32 44
  16. 56 88
  17. 102 127
  18. 135 145";
  19. var res = Regex.Replace(s, pat, m => m.Groups[1].Success ?
  20. $"0 {m.Groups[2].Value}{m.Groups[3].Value} " : $"{m.Groups[2].Value}{m.Groups[3].Value} ");
  21. Console.WriteLine(res);
  22. }
  23. }
Success #stdin #stdout 0.04s 134912KB
stdin
Standard input is empty
stdout
0 10 25
25 32 44
44 56 88
88 102 127
127 135 14510 25
25 32 44
44 56 88
88 102 127
127 135 145