Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 11-27-2024, 12:04 AM   #1
RenniePet
Junior Member
RenniePet began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Sep 2023
Device: Kindle
docx to epub, questions about regex search & replace

I use calibre to convert my Word docx files to epub, and think it's great.

Now I'd like to try to automate some of the manual editing I do in Word before each conversion, by using the regex Search & replace facility, if possible.

Questions:

What exactly is the regex function being applied to? Is it working on some kind of html, or an internal docx format of the text?

Can the regex function recognize a multi-line target? And if so, replace it with fewer lines? And how?

Thanks.
RenniePet is offline   Reply With Quote
Old 11-27-2024, 01:39 AM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,715
Karma: 29711016
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by RenniePet View Post
I use calibre to convert my Word docx files to epub, and think it's great.

Now I'd like to try to automate some of the manual editing I do in Word before each conversion, by using the regex Search & replace facility, if possible.

Questions:

What exactly is the regex function being applied to? Is it working on some kind of html, or an internal docx format of the text?

Can the regex function recognize a multi-line target? And if so, replace it with fewer lines? And how?
The help text for Search & Replace is :
Quote:
Search and replace uses regular expressions. See the regular expressions tutorial to get started with regular expressions. Also clicking the wizard button below will allow you to test your regular expression against the current input document. When you are happy with an expression, click the Add button to add it to the list of expressions.
That would seem to imply it works on the input file - i.e. the DOCX. But I don't know for certain that that is the case. Kovid Goyal will no doubt provide a definitive response.

FWIW, I use a couple of Word Add-ons that have 'advanced' S&R tools:

e-Book Tools - a Word add-in - even though it's no longer under development, it still works for me with the latest Office 365.

Translator Tools – Productivity tools for editing and translation

BR
BetterRed is offline   Reply With Quote
Advert
Old 11-27-2024, 01:55 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,330
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It works against the html representation of the input document as you can see for yourself by clicking the wizard button next to it which will show you the actual html it will run on and allow you to develop and test the regular expression you want to use.
kovidgoyal is offline   Reply With Quote
Reply

Tags
calibre docx epub regex


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex search & replace help ownedbycats Library Management 2 01-09-2023 01:24 AM
Regex in search problems (NOT Search&Replace; the search bar) lairdb Calibre 3 03-15-2017 07:10 PM
Regex help: Edit Meta Search & Replace: Pad with zero _noel_ Calibre 4 11-26-2012 04:31 PM
2 Questions about Bulk Edit Search & Replace BookJunkieLI Library Management 6 02-19-2012 01:39 PM
Search & Replace/Regex help!! millertime13 Conversion 4 07-22-2011 02:40 AM


All times are GMT -4. The time now is 04:15 AM.


MobileRead.com is a privately owned, operated and funded community.