using System;
using System.Linq;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
var delim = new string[] {"fox", "lazy"};
var pattern = @"(?:\s|^)(?:" + string.Join("|", delim.Select(Regex.Escape)) + @")(?:\s|$)";
var x = Regex.Split(
"quick brown fox jumps over the lazy dog"
, pattern
);
Console.WriteLine(pattern);
foreach (var s in x)
Console.WriteLine("[{0}]", s);
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLlRleHQuUmVndWxhckV4cHJlc3Npb25zOwoKcHVibGljIGNsYXNzIFRlc3QKewoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKQoJewoJCXZhciBkZWxpbSA9IG5ldyBzdHJpbmdbXSB7ImZveCIsICJsYXp5In07CgkJdmFyIHBhdHRlcm4gPSAgQCIoPzpcc3xeKSg/OiIgKyBzdHJpbmcuSm9pbigifCIsIGRlbGltLlNlbGVjdChSZWdleC5Fc2NhcGUpKSArIEAiKSg/OlxzfCQpIjsKCQl2YXIgeCA9IFJlZ2V4LlNwbGl0KAoJCQkicXVpY2sgYnJvd24gZm94IGp1bXBzIG92ZXIgdGhlIGxhenkgZG9nIgoJICAgICwgICBwYXR0ZXJuCgkgICAgKTsKCSAgICBDb25zb2xlLldyaXRlTGluZShwYXR0ZXJuKTsKCSAgICBmb3JlYWNoICh2YXIgcyBpbiB4KQoJICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiW3swfV0iLCBzKTsKCX0KfQ==