Beispiel #1
0
 private static string Pack(IEnumerable <string> aexp, PcrOptions options)
 {
     if (options.HasFlag(PcrOptions.Special))
     {
         return("(" + String.Join("|", aexp.Select(i => PreCompile(i))) + ")\\b");
     }
     if (options.HasFlag(PcrOptions.Precompiled))
     {
         return("\\b(" + String.Join("|", aexp.Select(i => PreCompile(i))) + ")\\b");
     }
     if (options.HasFlag(PcrOptions.Keywords))
     {
         return("\\b(" + String.Join("|", String.Join("|", aexp)) + ")\\b");
     }
     return(String.Join("|", aexp));
 }
Beispiel #2
0
 public PCR(string name, IEnumerable <string> exp, PcrOptions options, RegexOptions regexOptions = RegexOptions.None)
     : base(Pack(exp, options), regexOptions, name, NS, true)
 {
 }
Beispiel #3
0
 public PCR(string name, string exp, PcrOptions options, RegexOptions regexOptions = RegexOptions.None)
     : base(PreCompile(exp), regexOptions, name, NS, true)
 {
 }
Beispiel #4
0
 private static string Pack(IEnumerable<string> aexp, PcrOptions options)
 {
     if (options.HasFlag(PcrOptions.Special))
         return "(" + String.Join("|", aexp.Select(i => PreCompile(i))) + ")\\b";
     if (options.HasFlag(PcrOptions.Precompiled))
         return "\\b(" + String.Join("|", aexp.Select(i => PreCompile(i))) + ")\\b";
     if (options.HasFlag(PcrOptions.Keywords))
         return "\\b(" + String.Join("|", String.Join("|", aexp)) + ")\\b";
     return String.Join("|", aexp);
 }
Beispiel #5
0
 public PCR(string name, IEnumerable<string> exp, PcrOptions options, RegexOptions regexOptions = RegexOptions.None)
     : base(Pack(exp, options), regexOptions, name, NS, true)
 {
 }
Beispiel #6
0
 public PCR(string name, string exp, PcrOptions options, RegexOptions regexOptions = RegexOptions.None)
     : base(PreCompile(exp), regexOptions, name, NS, true)
 {
 }