![]() |
#1 |
Connoisseur
![]() Posts: 62
Karma: 10
Join Date: Jun 2012
Device: Kindle, iPad
|
Search and replace sometimes doesn't work across all files
I have had this problem for some time where a search arguement (regex) does not operate across all files in the book and one either has to combine all the files, then do the search/replace or do each file individually.
Last time I reported this and provided a book as an example, I was severely rapped over the knuckles. Is there some way to provide an example of this which would not get me excommunicated? |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you wish to report a bug and attach a sample, follow the procedure at https://calibre-ebook.com/bugs
|
![]() |
![]() |
![]() |
#3 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,181
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
|
![]() |
![]() |
![]() |
#4 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 450
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Kobo Forma
|
I have found that once in a blue moon, a search in the editor set to "all text files" will only do one file at a time. So rare I've never been able to replicate it on purpose. I've assumed it's just some odd book.
OTOH, I do notice that if you run a saved search (usually several at a time) over "all style files", it will not catch everything unless at least one css file is open. So I've just gotten into the habit of making sure one is open if I do a search like that. |
![]() |
![]() |
![]() |
#5 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
![]() ![]() I have had this also. Usually after doing a "current file" replace all (and liking the result, then switching to All files) I chalked it up to invisible code differences. |
![]() |
![]() |
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If someone can come up with a reproducible way to make all text files or all style files not do what they are supposed to, I am all ears.
|
![]() |
![]() |
![]() |
#7 |
Book E d i t o r
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
|
I've found that you do have to hit Beautify before doing a search. Otherwise, searching might not or usually will not find what you're searching for.
|
![]() |
![]() |
![]() |
#8 |
Connoisseur
![]() Posts: 62
Karma: 10
Join Date: Jun 2012
Device: Kindle, iPad
|
I think I am closer to isolating cases where search does not work across all text files. If you use a search argument (using CMD-F) that is across multiple lines of source, it often does not work across all files
e.g <p class="calibre_4"> <img src="\.\./images/line\.jpg" class="calibre_5"/> </p> will not search across all files in the current book I am editing. If you change this to <p class="calibre_4">\s+<img src="\.\./images/line\.jpg" class="calibre_5"/>\s+</p> then the search works across all files |
![]() |
![]() |
![]() |
#9 | |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 450
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Kobo Forma
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
or use the flower (beautify) before.
YMMV as to the look of beautiful code, but it will be normalized |
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Yes, I have found that you need to Beautify the book first to ensure all search results are captured.
I have also found that those that are missed are due to some instances using the No-Break space instead of a standard Space. So I also run a regex to remove those. Usually they are an additional space that is not needed, so I clear them out. It really had me pulling my hair out in my early editing days. I have also found that when I untick "Wrap" it works as expected on a single file in the Editor, but when using All Files, the unticked Wrap setting is ignored and it wraps around to the start of the book and replaces unwanted instances and I end up with, as an example, <em><em>some word</em></em> which means an additional S&R to clear that out. Last edited by Karellen; 11-10-2021 at 12:03 AM. Reason: edit to correct misinterpretation |
![]() |
![]() |
![]() |
#12 |
Connoisseur
![]() Posts: 62
Karma: 10
Join Date: Jun 2012
Device: Kindle, iPad
|
I agree with you, however CMD-F transfers all characters, visible and invisible to the search argument and if I manually move to the next file, a match is found, so I don't think the original question is yet addressed
|
![]() |
![]() |
![]() |
#13 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
If it is changing "unwanted" instances, then either you have the search wrong, or the search scope wrong. You do run the risk of wrapping and repeating change already made if the changed value matches the search. In your case, if your search was "(some word)" and the change was "<em>\1</em>", then if you didn't stop when you reached the first change, it would match again and you would get a result like you have. |
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Ahh, I was careless with my proof reading. Let me fix my post so it reads what I intended.
What I meant to say is: I have also found that when I untick "Wrap" it works as expected on a single file in the Editor, but when using All Files, the unticked Wrap setting is ignored and it wraps around to the start of the book and replaces unwanted instances and I end up with, as an example, <em><em>some word</em></em> which means an additional S&R to clear that out. |
![]() |
![]() |
![]() |
#15 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regex Search Repetition doesn't work?! | Wasserpulle | Sigil | 34 | 02-17-2018 02:49 PM |
Regex Search doesn't search all files in Edit Book | GregTheGrate | Editor | 8 | 11-08-2016 12:47 AM |
Vers 7 CMD-V does not work into the search and replace fields | GregTheGrate | Sigil | 25 | 04-22-2013 12:54 PM |
Metadata Search & Replace - when it doesn't match | Aldebaranian | Library Management | 4 | 09-28-2011 11:35 AM |
Search & Replace doesn't work for quotes | habanr | Conversion | 11 | 04-22-2011 11:50 AM |