![]() |
#1 |
Junior Member
![]() 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 |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,242
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Search: ([A-Za-z])-([A-Za-z])
Replace: \1\2 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
Tags |
calibre replace regexp |
|
![]() |
||||
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 |