Possible Duplicate:
RegEx match open tags except XHTML self-contained tags
I am not very good at regex.
So here is my question: How can I get all the links between
<td><a href="
and ">
?
<td><a href="link">
Possible Duplicate:
RegEx match open tags except XHTML self-contained tags
I am not very good at regex.
So here is my question: How can I get all the links between
<td><a href="
and ">
?
<td><a href="link">
Use the HTML Agility Pack for parsing HTML files:
Once you are using the DLL you can fetch the value using code like that:
linkNode.Attributes["href"]
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(@"<td><a href=""link"">");
var links = doc.DocumentNode.SelectNodes("//a[@href]")
.Select(a => a.Attributes["href"].Value)
.ToList();