regex - Get Div Content with Regular Expressions in C# -


i have html code:

<div id="top" style="something dont know"> text </div> 

and want string "text". script looks this:

regex search_string = new regex("<div id=\"top\".*?>([^<]+)</div>"); match match = search_string.match(code); string section = match.groups[0].value; messagebox.show(section); 

is possible c#?

use xpath easier

http://www.codeproject.com/kb/cpp/myxpath.aspx

use xpath selector

//div[@id='top'] 

then u can inner value


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -