View Single Post
Old 03-02-2018, 12:02 PM   #2
sjfan
Addict
sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.sjfan ought to be getting tired of karma fortunes by now.
 
Posts: 281
Karma: 7724454
Join Date: Sep 2017
Location: Bethesda, MD, USA
Device: Kobo Aura H20, Kobo Clara HD
Quote:
Originally Posted by G2B View Post
I am experimenting with the search & replace in calibre.


Conversion of txt files often leaves too many line breaks, even with heuristic processing.

When the </p><p class="whatever"> line breaks have small letters on both sides, they can always be removed and substituted with a space.

'[a-z]</p><p class="whatever">[a-z]' finds all those repeats but when I replace with '[a-z] [a-z]' the conversion also removes and replaces every letter before and after the code with the string '[a-z]' which is not what I intended.

I have to include '[a-z] in the search string to find the correct line breaks. If I don't, I'll delete every line break in the book, which imo makes it pretty much unreadable.

Is there a way to include those letters before and after line break in the search string, but to exclude them from substitution?

TIA.
Put parens around parts of the search string to form groups. Use \# in the replace string to replace with the content of that group.

Search for:
Code:
([a-z])</p><p class="whatever">([a-z])
Replace with:
Code:
\1 \2
sjfan is offline   Reply With Quote