예제 #1
0
            public override bool IsMatch(string line)
            {
                if (nextLineMatch)
                {
                    nextLineMatch = false;
                    MatchCollection matches = secondLineRegex.Matches(line);
                    if (matches.Count > 0)
                    {
                        if (SubMatchRegex != null)
                        {
                            foreach (Match match in matches)
                            {
                                string val = match.Groups[1].Value;
                                ProcessMatches(SubMatchRegex.Matches(val));
                            }
                        }
                        else
                        {
                            ProcessMatches(matches);
                        }

                        return(true);
                    }
                    else
                    {
                        Debug("Warning: " + ContextName + ": regex matched but value regex: " + secondLineRegex + " did not match line: " + line);
                    }
                }
                else if (Regex.IsMatch(line))
                {
                    nextLineMatch = true;
                }
                return(false);
            }
예제 #2
0
            public virtual bool IsMatch(string line)
            {
                MatchCollection matches = regex.Matches(line);

                if (matches.Count > 0)
                {
                    if (SubMatchRegex != null)
                    {
                        foreach (Match match in matches)
                        {
                            string val = match.Groups[1].Value;
                            ProcessMatches(SubMatchRegex.Matches(val));
                        }
                    }
                    else
                    {
                        ProcessMatches(matches);
                    }

                    return(true);
                }

                return(false);
            }