View Single Post
Old 09-10-2022, 09:09 PM   #10
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 781
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Sage
I guess it's not a needful thing, but in case some other person wants to do something similar, I'm starting to look at this from a different direction. Instead of working with the <i>/</i> pair and the text in between, I've decided to look for the whitespace between adjacent italicized paragraphs:
Code:
find: </i>([\.\?]?</p>\s+?<p[^>]*>)<i>
replace: \1
I'm assuming if there are consecutive entire paragraphs italicized, there's probably some kind of semantic block involved. Once I find the start of such a block, I can remove the intervening </i> and <i> pairs with "Replace and Find" and leave only the single starting and ending pair. I can probably work with that more easily.

Last edited by enuddleyarbl; 09-11-2022 at 06:35 PM. Reason: initial code didn't handle classless paragraphs & punctuation
enuddleyarbl is offline   Reply With Quote