![]() |
#1 |
Zealot
![]() ![]() ![]() ![]() Posts: 143
Karma: 387
Join Date: Sep 2010
Device: Kindle 3
|
Bulk Search & Replace Question (regexp)
Hi everyone,
I learned enough about regular expressions that I can extract parts of, say, titles to rearrange them. This time, however, I have a bunch of books of a series and the series number ended up in the title. I can extract that that serial number all right, but when I try to assign it to the series_index field I get the error message that it can not be converted to float. How do I fix that? There must be some Python magic that is beyond by regexp skills. Thanxx for any help, Mixx PS: May I suggest that in a future release this is taken care of and there is an automatic conversion to float (why float, why not integer BTW) if a number string is assigned to series_index? |
![]() |
![]() |
![]() |
#2 |
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
I suspect that your regexp contains other things than numbers. And that is why it can't be converted. You need to debug the regexp.
The series index is a float, not an integer. That is so you can specify decimal values like 1.40, if you wish. But you can also specify 1 or 2. Will automatically be converted to 1.00 and 2.00. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,353
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Assuming the series is in brackets and that none contain decimal points, the search expression should be something like "^.*\[([\d])\].*$" and the replacement expression should be "\1" |
|
![]() |
![]() |
![]() |
#4 |
Zealot
![]() ![]() ![]() ![]() Posts: 143
Karma: 387
Join Date: Sep 2010
Device: Kindle 3
|
My bad, it does work now, thanks a million.
Last edited by Mixx; 12-12-2013 at 02:05 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bulk search & replace question | Capricorn | Calibre | 0 | 08-23-2013 05:12 AM |
Bulk search and replace operations - question | SFD1968 | Calibre | 1 | 03-01-2013 09:23 AM |
2 Questions about Bulk Edit Search & Replace | BookJunkieLI | Library Management | 6 | 02-19-2012 01:39 PM |
Search & Replace question - something not right | curiosity | Library Management | 21 | 06-15-2011 11:33 AM |
Setting series index in bulk metadata search&replace | bubak | Calibre | 4 | 12-19-2010 04:04 PM |