View Single Post
Old 11-07-2020, 09:47 AM   #1
G2B
Enthusiast
G2B began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Feb 2018
Device: PC / iPad
batch processing regex search/replace?

When I edit epub ebooks, I try to make them as light as possible by removing all the tags that are not strictly necessary, usually ending up with a stylesheet with anything from 2 to 8 styles at the most for books with 1000s of pages. It can reduce the size of the ebook by half or more.

This is of course repetitive.
Is there a way to batch-process a number of search and replace commands all at once instead of having to type them in? I wouldn't be surprised if that has been included, I just haven't found it.
These are just a few of a long list that I use with every book I edit.
REPLACE
<body [^>]*>
WITH
<body class="calibre">

REPLACE WITH NOTHING
id="[^\"]*"
<a [^>]*>


REPLACE this with that
<b [^>]*> <b>
<i [^>]*> <i>
<em [^>]*> <em>


ETC. ETC.

Thank you for your time.
G2B is offline   Reply With Quote