Reputation: 11652
I was wondering if somebody could help me use string split to get all occurrences of text in between <p>
</p>
tags in an HTML document?
Upvotes: 0
Views: 698
Reputation: 71206
i've been doing this manually, just traversing the string in a loop and counting the <p>
tags and if you found one <p
and than another <p
and another and than you suddenly have a </p>
than you must wait until you find the 3rd </p>
and there you have it
Upvotes: 0
Reputation: 119806
For the benefit of the folks who suggest RegEx, can I just point to this answer:
RegEx match open tags except XHTML self-contained tags (Stack Overflow)
Just say no.
Upvotes: 1
Reputation: 25505
Take a look at regular expressions. String split is not a good solution.
Upvotes: 2
Reputation: 29157
Sounds like you want to look at the HTML Agility Pack. It works very well on dodgy HTML documents!
Upvotes: 6
Reputation: 10645
That's rather a large problem for String.Split()
. I'd recommend using an XML parser instead.
Upvotes: 2