-1

Alright, so off a website (that I don't own, so I can't modify it), I have this:

<body onload="do_cd();">
<div id="main_container">
<div id="main_content">
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div class="well">
<div class="row-fluid">
<div class="span6">
<p>
<b>

And then all the closing tags.

In that <b> portion , there is text. How do I extract that text in there and set a string with it?

Ken White
  • 123,280
  • 14
  • 225
  • 444
Jon
  • 2,566
  • 6
  • 32
  • 52
  • I suggest using the HTML Agility Pack, located here: http://htmlagilitypack.codeplex.com/, alternativly you could also try a regexe. – Rivasa Sep 23 '12 at 21:30
  • 2
    http://stackoverflow.com/questions/56107/what-is-the-best-way-to-parse-html-in-c – Chris Dargis Sep 23 '12 at 21:31
  • 1
    Parse with regex? http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 – Tim Schmelter Sep 23 '12 at 21:33
  • Could a moderator delete this? I contacted another guy who told me how. – Jon Sep 23 '12 at 21:49
  • @chipperyman573: The better option would be to show others how you've done it. You can even accept your own answer. – Tim Schmelter Sep 23 '12 at 21:51
  • @TimSchmelter Ok, thanks for the heads up. I'll accept it in 2 days (when it lets me) – Jon Sep 23 '12 at 21:57

2 Answers2

1

Ok, so I contacted a guy that I know and he told me how to do it for this purpose:

string DownloadFileName = Regex.Match(PageSource, DownloadFileLink + "\">(.*?)</a></li></div></ul>").Groups(1).Value;
Jon
  • 2,566
  • 6
  • 32
  • 52
0

I suggest using the HTML Agility Pack. It gets the job done perfectly and is very powerful.

Community
  • 1
  • 1
Rivasa
  • 6,510
  • 3
  • 35
  • 64