-2

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">
Community
  • 1
  • 1
user1572130
  • 65
  • 10

2 Answers2

2

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"]
wp78de
  • 18,207
  • 7
  • 43
  • 71
Carlos Landeras
  • 11,025
  • 11
  • 56
  • 82
1
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();
L.B
  • 114,136
  • 19
  • 178
  • 224