c# - How to retrieve data from an html string from a span tag by using Regular Expressions? -


i need retrieve info html doc since web service json or xml still not ready. im working c# , using regular expressions data need html string. i've managed div want work whole html string i'm having trouble getting info between first span tag. i've attempted retrieve data between ; , first closing span tag want content between first span tag.

here's regular expression i've written far, it's not working:

".*;(?<content>(\r|\n|.)*)</span>" 

i tried didnt work either:

"<span class=""type"">(?<content>(\r|\n|.)*)</span>" 

here div want retrieve data from:

<div class="main">abasasdfÓ 18/06/2014 17:38h&nbsp; blabla balbal&nbsp; <span class="type">15.80&#8364;&nbsp; </span>+1.94 % +0.30&#8364; &nbsp;|&nbsp;home <span class="type2">11,398.70</span>&nbsp; +0.65 % +74.10</div> 

edit: can't use htmlagilitypack since client not want use external library. i've heard using xmlreader i'm not sure structure of html match xml 1 accordingly.

this regex capture string:

"<span class=\"type\">(?<content>([^<]*))</span>" 

although, agree other answers, should use path instead of regexes parsing html.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -