user1489472
user1489472

Reputation: 11

How can I get inner html content using Regular Expression

<div class="colmask">
  <h1 class="continent_header"><a name="US"></a>US</h1>
    <div class="colmid">
        <div class="colin">
          <div class="colleft">
          .......
          ....... 
          </div>
         </div>
    </div>
   </h1>
 </div>

How can I get the inner html of tag using Regular Expression ? It means the result will be

  <h1 class="continent_header"><a name="US"></a>US</h1>
    <div class="colmid">
        <div class="colin">
          <div class="colleft">
          .......
          ....... 
          </div>
         </div>
    </div>
   </h1>

Upvotes: 0

Views: 1620

Answers (1)

dtsg
dtsg

Reputation: 4468

Please don't use regular expressions to parse HTML, instead use HTML Agility Pack.

You can achieve what you want via:

string elementText = doc.GetElementbyId("ELEMENTID").InnerHtml;

Upvotes: 1

Related Questions