View Single Post
Old 07-25-2022, 06:00 PM   #2
kjdavies
Zealot
kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.kjdavies is no e-book dilettante.
 
Posts: 112
Karma: 53342
Join Date: Jun 2013
Device: Sony PRS-600
Quote:
Originally Posted by lbutlr View Post
I imported some books that had titles like “Name of Series 01 Title of First book in series”. I tried to use the multi-edit find and replace to set the series name and index number and was able to do so. I ended up doing it by hand, but I am curious if this is possible.

First, I searched title for (\d\d) and tried to set the index number to \1 but got a string conversion error. I am guessing that Calibre did not like the ’01’ and that I would need to somehow get a ‘1’ and also get a ’11’, but I didn’t have time to figure out the regex for that… ([1-9]?\d) maybe?)

Also, it looks like this would have to be done in two steps, at minimum, one to set the series name and on to set the index number, or is there a way to set both fields in one swell loop?
I've done this quite a bit. The RE for this one might be something like
^(.*?) (\d+)\s*
Assigning to series as
\1 [\2]
That is,
Name of Series 01 Title of First book in series
results in the series and series index of
Name of Series [1.00]
because of how the series_index is managed after assignment. The title and sort_title are unchanged. You'll have to go back a second time to remove the name of the series and the series_index value from the title... which is why I wrote the RE as I did, so it can be reused (apply find and replace on title, assigning nothing to the title, will replace 'Name of Series 01 ' with nothing, leaving you with 'Title of First book in series' in the title field).
kjdavies is offline   Reply With Quote