Exemple #1
0
            public static PatternElement[] Parse(WildcardPattern pattern, CharacterNormalizer characterNormalizer)
            {
                var parser = new MyWildcardPatternParser {
                    _characterNormalizer = characterNormalizer,
                    _regexOptions        = WildcardPatternToRegexParser.TranslateWildcardOptionsIntoRegexOptions(pattern.Options)
                };

                Parse(pattern, parser);
                return(parser._patternElements.ToArray());
            }
        public static Regex Parse(WildcardPattern wildcardPattern)
        {
            Regex regex;
            var   parser = new WildcardPatternToRegexParser();

            Parse(wildcardPattern, parser);
            try {
                regex = new Regex(parser.regexPattern.ToString(), parser.regexOptions);
            }
            catch (ArgumentException) {
                throw NewWildcardPatternException(wildcardPattern.Pattern);
            }
            return(regex);
        }
 public static Regex Parse (WildcardPattern wildcardPattern)
 {
     Regex regex;
     var parser = new WildcardPatternToRegexParser();
     Parse(wildcardPattern, parser);
     try {
         regex = new Regex(parser.regexPattern.ToString(), parser.regexOptions);
     }
     catch (ArgumentException) {
         throw NewWildcardPatternException(wildcardPattern.Pattern);
     }
     return regex;
 }
Exemple #4
0
 protected override void AppendLiteralCharacterToBracketExpression(char c)
 {
     WildcardPatternToRegexParser.AppendLiteralCharacterToBracketExpression(_bracketExpressionBuilder, c);
 }
Exemple #5
0
 protected override void AppendCharacterRangeToBracketExpression(char startOfCharacterRange, char endOfCharacterRange)
 {
     WildcardPatternToRegexParser.AppendCharacterRangeToBracketExpression(_bracketExpressionBuilder, startOfCharacterRange, endOfCharacterRange);
 }