Annoying but not insurmountable. EscapeSequence defaults to '\' but can be reconfigured. It also includes "\\" or the equivalent by default with the proper order. Example time:
EscapeSequence Slash = new EscapeSequence(); Slash.Add('t', ' '); Parser EscapeTest = (new Expression(new System.Text.RegularExpressions.Regex(@"[a-zA-Z\ ]")) | Slash).OneOrMore; string EscapeTestString = @"moo\tmoo\\t"; IndexTree EscapeResult = EscapeTest.Parse(EscapeTestString); Console.WriteLine("Before Escaping: {0}", EscapeTestString); foreach (string s in EscapeResult.ViewTree(EscapeTestString)) { Console.WriteLine(s); } Console.WriteLine(); Slash.ProcessEscaping(EscapeResult, ref EscapeTestString); Console.WriteLine("After Escaping: {0}", EscapeTestString); foreach (string s in EscapeResult.ViewTree(EscapeTestString)) { Console.WriteLine(s); }
Results:
Before Escaping: moo\tmoo\\trms.Support.Parsing.Series 0:11 - moo\tmoo\\t rms.Support.Parsing.Expression 0:1 - m rms.Support.Parsing.Expression 1:2 - o rms.Support.Parsing.Expression 2:3 - o rms.Support.Parsing.EscapeSequence 3:5 - \t rms.Support.Parsing.Expression 5:6 - m rms.Support.Parsing.Expression 6:7 - o rms.Support.Parsing.Expression 7:8 - o rms.Support.Parsing.EscapeSequence 8:10 - \\ rms.Support.Parsing.Expression 10:11 - tAfter Escaping: moo moo\trms.Support.Parsing.Series 0:9 - moo moo\t rms.Support.Parsing.Expression 0:1 - m rms.Support.Parsing.Expression 1:2 - o rms.Support.Parsing.Expression 2:3 - o rms.Support.Parsing.CharParser 3:4 - rms.Support.Parsing.Expression 4:5 - m rms.Support.Parsing.Expression 5:6 - o rms.Support.Parsing.Expression 6:7 - o rms.Support.Parsing.CharParser 7:8 - \ rms.Support.Parsing.Expression 8:9 - t