View Single Post
Old 12-02-2023, 07:23 PM   #6
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,622
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by gtriever View Post
My apologies, but I'm embarassingly lost by what you just wrote... in fact, in my original post I incorrectly asked for a regex expression when it should have been an XPath expression.
What @theducks is trying to accomplish is to make your headings unique so you can easily split the pages.
Currently your headings have the same styling as your paragraphs, so there is no way to distinguish one from the other.
Except for the double dash/hyphen. Because of this unique use, and if the use is limited to those headings only, then you can use that uniqueness to capture those headings and change the coding to <h2>heading</h2>. From there you can easily split the chapters into separate files.

So insert that regex into the Search box and make sure you have selected "regex" as the search type.
Though for the replace I would use a simpler <h2>\1</h2>
Step through the first few one at a time to make sure it works correctly, then if you have a lot of chapters you can just replace all.
Karellen is offline   Reply With Quote