Reputation: 2741
How to get the first sentence from the first paragraph?
<h2>Test</h2>
<p class="preserve">
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi. Euismod in pharetra a, diam.
</p>
<p class="preserve">
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi. Euismod in pharetra a, diam.
</p>
My regex take all the sentences from the first and the second paragraph.
<p.*>.*\.\s[A-Z]
Upvotes: 0
Views: 1004
Reputation: 5825
This will put the first sentence of each paragraph in Group 1
<p.*>\s*([A-Z].+?)(?=\.\s[A-Z])
Upvotes: 1
Reputation: 10681
Steps:
p
tag and space charactes after it - <p.*?>\s+
.*?\.
.<p.*?>\s+(.*?)\.
Upvotes: 2