01-26-2019, 04:29 AM | #1 |
Junior Member
Posts: 1
Karma: 10
Join Date: Jan 2019
Device: Kindle gen3
|
Search and Replace not being done
I went so far as to copy and use the very first line in the pdf to replace it with some obvious text, but even that didn't work. I am aware of the way to write these, I wanted to remove the page numbers, "1 | 200" so \d+ \| \d+ was used, and replace was left blank. I have tested multiple formats and opened each one to verify nothing changed, it is really getting on my nerves. Am I missing a "run replace then convert" sort of step? I'm almost certain it should do it while converting it. While I'm asking, will this still work when converting multiple files at once if the page number format is the same for all of them?
|
01-26-2019, 09:31 PM | #2 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Make sure you are running up to date versions of calibre, which autoreplace non-breaking spaces in the PDF with spaces, which is likely what is tripping up your search expression.
|
01-27-2019, 11:44 AM | #3 |
Addict
Posts: 387
Karma: 1638210
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
|
I usually fix these in the editor, but after reading this post I tripped across a similar one yesterday so I tried it in the conversion. (It had "title / #" and "# / author" on alternate pages.) I got exactly the same result...no replacement in the conversion, even though the test found them just fine - using 3.38.1. After conversion, in the editor, I used exactly the same regex strings, and it worked perfectly. There were no non-breaking spaces in the page headers after conversion, although there were a few in the main text. So it looks like there may be still something going on.
|
01-28-2019, 01:03 AM | #4 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
then open a bug report and attach the file alongwith the search expression used.
|
01-28-2019, 11:08 AM | #5 |
Addict
Posts: 387
Karma: 1638210
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Jutoh, Kobo Forma
|
It does work
I went to replicate the problem for a bug report, and had a thought along the way. Instead of just using space characters in the search string, I tried \s+, and it worked beautifully.
Code:
title\s+/\s+\d+ \d+\s+/\s+author I noticed in the book text that there were a LOT of extra spaces coming across, sometimes inside words, sometimes between words. So I guess that is in the pdf text layer. |
01-28-2019, 05:13 PM | #6 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
I have been doing conversion tests with several pdf to epub, with Calibre 3.38.1 (64 bit), and I have verified that non-breaking spaces are not replaced to spaces.
|
01-28-2019, 11:11 PM | #7 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
yeah sorry I mi-remembered, it is nto that it replaces non-breaking spaces with spaces, but that it replaces the use of an HTML entity to encode non-breaking spaces, which allows S&R to work
|
01-29-2019, 12:34 AM | #8 |
Interested in the matter
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
OK. S works, but for R to work it's necessary to use \s
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regex in search problems (NOT Search&Replace; the search bar) | lairdb | Calibre | 3 | 03-15-2017 07:10 PM |
Search and replace wish | LadyKate | Editor | 5 | 05-17-2015 09:53 AM |
save multiple search/replace, or search/replace multiple ebooks | user743 | Editor | 12 | 04-12-2014 02:38 AM |
Need Help with Search and Replace please! | worley | Conversion | 2 | 07-28-2012 09:29 AM |
search and replace - drops blanks in replace ? | cybmole | Conversion | 10 | 03-13-2011 03:07 AM |