fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var delimiters = new List<string> { " " };
  12. var line = "if(a>b) write(\"My new result\")";
  13. delimiters = delimiters.Select(d => Regex.Escape(d)).ToList();
  14. delimiters.Add(@"""[^""\\]*(?:\\.[^""\\]*)*""");
  15. var pattern = "(" + String.Join("|", delimiters) + ")";
  16. List<string> result = Regex.Split(line, pattern).ToList();
  17. foreach (var s in result)
  18. Console.WriteLine(s);
  19. }
  20. }
Success #stdin #stdout 0.12s 24712KB
stdin
Standard input is empty
stdout
if(a>b)
 
write(
"My new result"
)