开发者

How to get html tags content

开发者 https://www.devze.com 2023-01-28 05:19 出处:网络
I want to get tags content in a string with regular expression. I wrote it for just one line. When the content changed into some lines from one 开发者_如何学Cline, Regex will never do pattern on the t

I want to get tags content in a string with regular expression. I wrote it for just one line. When the content changed into some lines from one 开发者_如何学Cline, Regex will never do pattern on the tag. I choose RegexOptions.Multiline + RegexOptions.Singleline for finding options.

My pattern in low level: (>)[ a-z A-z 0-9 ]*(</)

Thanks.


It's not cool parsing HTML with Regular Expressions. There's a .NET code library called HTML Agility Pack for that.


Are you looking for the nodeValue attribute? that should let you get the content from a div tag.

http://www.javascriptkit.com/domref/elementproperties.shtml

0

精彩评论

暂无评论...
验证码 换一张
取 消