Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-05-2015, 12:34 AM   #1
DaveClouding
Junior Member
DaveClouding began at the beginning.
 
Posts: 3
Karma: 10
Join Date: May 2015
Device: Kobo Aura H2O
Calibre problem with 'REPLACE WITH' RegExp

Hello and thanks to everyone,

I am quite new to Calibre and I am trying to use it's ebook converter (last version of Calibre) to operate a string Search and Replace inside an epub ebook's text during the conversion process.

I carefully read the Calibre RegExp tutorial as well as several other articles I googled for, and played around with it for a whole couple of hours, but I still could not figure out how to reach my goal.

Let me explain, using an example, which is the problem I am facing:

Let we say I need to find and remove, inside the book's text, all the occurrences of the hyphen (-) character which are included between two alphabetical characters.

I.E the expression 'preg-nancy' should be converted into the correct word 'pregnancy'.

For this reason, according to the Calibre manual, I put, inside the SEARCH EXPRESSION field, the following Regular Expression:

[A-Za-z]-[A-Za-z]

The processor correctly finds what I mean and, jumping back to the above example, it selects the portion 'g-n' inside the word 'preg-nancy' (and all the other words with the hyphen inside).

Now, I really cannot understand which RegExP I have to put into the REPLACE WITH field to let the processor to just remove the hyphen (-) character between the two alphabetical ones, while leaving all the other character inside the word untouched, thus transforming the word 'preg-nancy' into the correct word 'pregnancy'.

I tried many combinations, but I really cannot find the correct solution.

Any help would be highly appreciated.

Thanks in advance.

Dave
DaveClouding is offline   Reply With Quote
Old 05-05-2015, 12:36 AM   #2
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,242
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Search: ([A-Za-z])-([A-Za-z])
Replace: \1\2
kovidgoyal is online now   Reply With Quote
Advert
Old 05-05-2015, 12:38 AM   #3
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,360
Karma: 78877538
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
Try
search: ([A-Za-z])-([A-Za-z])
replace: \1\2

The ()'s "save" the matched bit and then the \1 \2 reference the saved bits.
PeterT is offline   Reply With Quote
Reply

Tags
calibre replace regexp


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chained search / replace regexp Terisa de morgan Library Management 23 01-26-2015 01:48 PM
Bulk Search & Replace Question (regexp) Mixx Library Management 3 12-12-2013 01:53 AM
Replace problem Poppeye Conversion 1 11-08-2011 03:48 AM
Search and Replace Problem FrozenInferno Conversion 11 08-13-2011 01:29 PM
Problem with replace with stgabriel Recipes 1 02-06-2011 04:37 PM


All times are GMT -4. The time now is 10:55 AM.


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