using System.Text.RegularExpressions;string test = @"%f hello world %d hello world \%s hello world %o"; string[] result = Regex.Split(test, @"(?<=([^\\])(|(\\\\)+))(?=%)", RegexOptions.ExplicitCapture); foreach (string s in result) { Console.WriteLine(s); }
string[] result = Regex.Split(test, @"(?<=([^\\])(|(\\\\)+))(?=%)", RegexOptions.ExplicitCapture);
foreach (string s in result)
{
Console.WriteLine(s);
}