Пример #1
0
 private Regex tryCompileRegex()
 {
     if (SearchType.regex == searchType)
     {
         if (String.Empty == regexPattern)
         {
             this.warn("Regex is empty");
             return(null);
         }
         return(tryCompileRegex(regexPattern, regexOptions));
     }
     if (SearchType.boolean == searchType)
     {
         if (String.IsNullOrWhiteSpace(booleanPattern))
         {
             this.warn("Boolean expression is empty");
             return(null);
         }
         String convertedRegexPattern = BooleanExpressions.combined(BooleanExpressions.bifurcated(SimpleExpressions.tokenised(booleanPattern)));
         return(tryCompileRegex(convertedRegexPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline));
     }
     if (SearchType.simple == searchType)
     {
         if (String.IsNullOrWhiteSpace(simplePattern))
         {
             this.warn("Simple expression is empty");
             return(null);
         }
         String convertedRegexPattern = SimpleExpressions.joined(SimpleExpressions.tokenised(simplePattern));
         return(tryCompileRegex(convertedRegexPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline));
     }
     return(null);
 }
Пример #2
0
 public static String combined(IEnumerable <String[]> thisStringArrayIEnumerable)
 {
     return(String.Format("({0})", String.Join(@"|", thisStringArrayIEnumerable.Select(a => SimpleExpressions.joined(a)))));
 }