Just gonna drop this snippet there now that I have a job. This is the less greedy version suggested earlier. The original would not work if there were several hyperlinks at the input. This code below will allow you to view all the hyperlinks:
static Regex rHref = new Regex(@"<a.*?href=[""'](?<url>[^""^']+[.]*?)[""'].*?>(?<keywords>[^<]+[.]*?)</a>", RegexOptions.IgnoreCase | RegexOptions.Compiled); public void ParseHyperlinks(string html) { MatchCollection mcHref = rHref.Matches(html); foreach (Match m in mcHref) AddKeywordLink(m.Groups["keywords"].Value, m.Groups["url"].Value); }
source share