View Single Post
Old 12-12-2013, 01:18 AM   #3
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,475
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Mixx View Post
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?
Search/Replace accepts integers just fine. As adoby said, you must be including some non-numeric characters in the result, such as the brackets.

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"
chaley is offline   Reply With Quote