String manipulation, how to easily extract the value of an HTML element?

I need to extract the value of an element from an HTML page many times. Something like that:

<!-- many html here -->
<input type="hidden" name="id" value="ExtractMe!">
<!-- many html here -->

How easy is it to extract value?

+3
source share
4 answers

Check out the HTMLAgility package , it makes this type of task very simple and without regex.

+4
source

If you need to parse HTML in your C # application, consider using HTMLAgilityPack here http://htmlagilitypack.codeplex.com/

+1
source

, , , XML. XML LINQ.

here .

0

Why aren't you using regular expressions? This is the MSEx Regular Expression Documentation , where you can see the section Extracting a Single Match or the First Match.

0
source

All Articles