Пример #1
0
        public IMatch Match(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return((IMatch) new SuccesMatch(text));
            }

            IMatch match = new SuccesMatch(text);

            while (match.Success())
            {
                match = pattern.Match(match.RemainingText());
            }

            return((IMatch) new SuccesMatch(match.RemainingText()));
        }
Пример #2
0
        public IMatch Match(string text)
        {
            IMatch match = new SuccesMatch(text);

            foreach (var pattern in patterns)
            {
                match = pattern.Match(match.RemainingText());
                if (!match.Success())
                {
                    return(new FailedMatch(text));
                }
            }

            return(match);
        }