C # regex
2 answers
The HTML Agility Pack is perfect for this; this is pretty much the same as the example on the home page:
foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href]")
{
string href = link["href"].Value;
}
Now just parse the "href"; maybe something like:
Match match = Regex.Match(href, @"[&?]\w+=(\d+)");
int i;
if (match.Success && int.TryParse(match.Groups[1].Value, out i))
{
Console.WriteLine(i);
}
+3
source to share