Beispiel #1
0
        private void ScrapeElements(string data, TargetElement element, List <string> scrapedElements)
        {
            MatchCollection matches = Regex.Matches(data, element.TargetRegex, element.RegexOption);

            foreach (Match match in matches)
            {
                if (match.Success)
                {
                    for (int idx = 1; idx < match.Groups.Count; idx++)
                    {
                        var matchData = match.Groups[idx].Value;
                        if (element.HasChildren())
                        {
                            foreach (var child in element.Children)
                            {
                                ScrapeElements(matchData, child, scrapedElements);
                            }
                        }
                        else
                        {
                            scrapedElements.Add(matchData);
                        }
                    }
                }
            }
        }
 public TargetElementBuilder WithChild(TargetElement child)
 {
     Children.Add(child);
     return(this);
 }