0

I'm trying to scrape an HTML webpage using regular expressions. Two of the three MatchCollections work, but the third one does not. I'm getting what i need from match and match_id, but when it comes to match_price, there is no result.

Can someone kindly tell me what is wrong?

WebClient wb = new WebClient();
string s = wb.DownloadString(@"C:\Users\Dell\Desktop\html pages\hi.html");
        MatchCollection match = Regex.Matches(s, "span class=\"\".*?</span>");
        MatchCollection match_id = Regex.Matches(s, "span class=\"product_id\".*?</span>");
        MatchCollection match_price = Regex.Matches(s, "div class=\"col-lg-2 col-md-2 col-sm-2 col-xs-2 align-right\".*?</div>");

foreach (Match m in match)
{
    listBox1.Items.Add(m);
}

foreach (Match m in match_id)
{
    listBox2.Items.Add(m);
}

foreach(Match m in match_price)
{
    listBox3.Items.Add(m);
}
alex
  • 6,818
  • 9
  • 52
  • 103
raza
  • 31
  • 4

0 Answers0