MahanGM
MahanGM

Reputation: 2382

How to get html tags content

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 line, 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.

Upvotes: 1

Views: 312

Answers (2)

Chris
Chris

Reputation: 4083

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

Upvotes: 0

Ruel
Ruel

Reputation: 15780

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

Upvotes: 2

Related Questions