-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
  • 17,272
  • 6
  • 36
  • 68
Carlos Landeras
  • 10,812
  • 11
  • 54
  • 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
  • 110,417
  • 19
  • 170
  • 215