fork(1) download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var delim = new string[] {"fox", "lazy"};
  10. var pattern = @"(?:\s|^)(?:" + string.Join("|", delim.Select(Regex.Escape)) + @")(?:\s|$)";
  11. var x = Regex.Split(
  12. "quick brown fox jumps over the lazy dog"
  13. , pattern
  14. );
  15. Console.WriteLine(pattern);
  16. foreach (var s in x)
  17. Console.WriteLine("[{0}]", s);
  18. }
  19. }
Success #stdin #stdout 0.06s 22188KB
stdin
Standard input is empty
stdout
(?:\s|^)(?:fox|lazy)(?:\s|$)
[quick brown]
[jumps over the]
[dog]