View Single Post
Old 02-25-2024, 12:34 PM   #5
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,603
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
So you want to find things like
<p class="calibre8"> <span class="calibre3"> — « There is a long sentence ending with a comma », said the man. « Then a second part of the blahblah dot »</span> </p>

and turn them into

<p class="calibre8"> <span class="calibre3"> — « There is a long sentence ending with a comma », said the man.</span> </p>
<p class="calibre8"> <span class="calibre3"> « Then a second part of the blahblah dot »</span> </p>



or into

<p class="calibre8"> <span class="calibre3"> — « There is a long sentence ending with a comma », said the man.<br /> « Then a second part of the blahblah dot »</span> </p>

The search term is the same either way.

(<p class="calibre8"> <span class="calibre3"> — «[^»]+»,.*?\.)( «)


(Well, assuming that all your </p> are followed by a new line, otherwise the .*? part of the pattern could run into the next paragraph)

And the replacement term is just the first capture group, what you want to insert, and then the second capture group, e.g.

\1<br />\2

Last edited by pdurrant; 02-25-2024 at 12:37 PM.
pdurrant is offline   Reply With Quote