![]() |
#1 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
5.0.1 Bug in find and replace in bulk
The substitution is doubled.
|
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
That's how .* has always behaved. it matches both the empty string and the character. You want .+ instead
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Indeed, I look for anything (including the empty string), and I want it to be replaced by the correct data (in my example: pp) and not by pppp.
In previous versions of Calibre, it worked correctly. |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The previous behavior was a bug, this is how regexes are supposed to behave, it was fixed in python 3 and hence also in calibre 5. For example:
Code:
python3 -c "import re; print(re.sub('.*', 'pp', 'a'))" pppp python2 -c "import re; print(re.sub('.*', 'pp', 'a'))" pp |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
And this is the search expression you use for this in python 3
Code:
^$|.+ |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Interested in the matter
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
|
Yes sir! thank you very much.
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to bulk replace images in EPUB? | mathil | ePub | 2 | 12-15-2019 06:30 PM |
find replace bug? | cybmole | Sigil | 14 | 11-07-2012 01:17 AM |
Find/Replace bug? | bfollowell | Sigil | 14 | 05-19-2012 01:14 PM |
Find/Replace Won't Find | Rand Brittain | Sigil | 7 | 09-24-2011 04:35 AM |
Any way to bulk replace... | drdann | Calibre | 1 | 12-31-2010 12:56 PM |