fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4. using System.IO;
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var s = "hello;there;;you;;;!;";
  10. var res = Regex.Split(s, @";(?!;)").Where(m => !string.IsNullOrEmpty(m));
  11. Console.WriteLine(string.Join(", ", res));
  12.  
  13. var s1 = "a;b;;";
  14. var res1 = Regex.Split(s1, @";(?!;)").Where(m => !string.IsNullOrEmpty(m)).ToList();
  15. Console.WriteLine(string.Join(", ", res1));
  16. }
  17.  
  18. }
Success #stdin #stdout 0.02s 30552KB
stdin
Standard input is empty
stdout
hello, there;, you;;, !
a, b;