Reputation: 628
I am using this pattern
const string ptnBodytext = @"<p>\s*(.+?)\s*</p>";
in order to extract the text within the <p>
tags. It works fine except for those text with newline, e.g.:
<p>
Lorem ipsum
second line or
third one?
</p>
How can I change the pattern in order to include newline, tabs and so on?
Upvotes: 1
Views: 84
Reputation: 43169
You either need to activate the dotall mode or:
const string ptnBodytext = @"<p>([\s\S]+?)</p>";
Upvotes: 4
Reputation: 9650
Just remove the \s*
:
const string ptnBodytext = @"<p>(.+?)</p>";
Upvotes: 2