04-29-2011, 11:34 AM | #1 | ||||
Member
Posts: 13
Karma: 10
Join Date: Apr 2011
Device: nook
|
Regexp for series in books library
Hi,
I want to bulk rename a list of books with the following naming pattern: Quote:
so I select the list and in bulk metadata I set a regexp to grab in title: Quote:
Quote:
therefore in the sample part I see it works as: Quote:
but doesn't actually write the metadata. I could do the same by enabling series in the basic metadata section but not all the series titles are in my collection, maybe I have from 1-20 and then 24-40 so if i make it the basic way it autoadds the 24-40 as 21-36 , that's why I wanted to use the regexp in search and replace. Could anyone help me? Last edited by noimporta; 04-29-2011 at 11:38 AM. Reason: sorting the code in quotes |
||||
04-29-2011, 11:51 AM | #2 |
Well trained by Cats
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Are you trying to store Series info in the Title
Calibre has a Series field for that and a series_index for the sequence number(displayed in the square braces after the series name in Library view). Bulk Metadata Edit (main tab) has a tool that can be used (with care ) to sequence WITHIN a series. Lots of if's and 1 series at a time Then there is the search and replace tab. Your Replace is rather tricky, so I would copy (a right click function on selected books) a batch of books to a 'test library' and work until you get it right. You are dealing with multi-field replace(fill) |
04-29-2011, 11:53 AM | #3 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Assigning
Code:
series_name series_index Code:
series_name [series_index] |
04-29-2011, 12:36 PM | #4 | ||||
Member
Posts: 13
Karma: 10
Join Date: Apr 2011
Device: nook
|
@theducks no, I'm not trying to do that but the opposite. My entry in the database has the series name series index - book title in the title field and I want to trim that. Therefore I'm trying to scrape series name and index into the series field.
I was trying to do that with the search & replace in bulk metadata mode. @Manichean where can I perform both operations at once? In search & replace I managed to do it in 2 passes but I was trying to get it working in one. I've setup one to grab the series name and set it and then another to grab the series index and set it. So far I don't know how to input both at the same time since I can only grab one item from the replace list. Just in case anyone finds the case fitting for their needs: I want to trim the following name convention: series_name series_number book title First I apply the series name to the files: search title for Quote:
Quote:
search title again for Quote:
Quote:
Last edited by noimporta; 04-29-2011 at 12:40 PM. |
||||
04-29-2011, 12:59 PM | #5 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Try searching for
Code:
(.*?) (\d+) - .*? Code:
\1 [\2] Also note that in the regexes in your last post, the first group '(*.)' is probably wrong, you most likely meant to use '(.*)'. |
04-30-2011, 03:48 PM | #6 | |||
Member
Posts: 13
Karma: 10
Join Date: Apr 2011
Device: nook
|
@Manichean thx a lot , it worked just fine.
But now a new problem came up. In the field tag I have all kind of info stored for some books and I want to extract the 13 character isbn to the identifier isbn. A tag could be: Quote:
Quote:
I forgot to add that not all tags are the same sometimes its Quote:
Last edited by noimporta; 04-30-2011 at 03:53 PM. |
|||
04-30-2011, 06:03 PM | #7 |
Addict
Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
.*([0-9]{13}).*
replace with \1 into identifiers isbn |
04-30-2011, 06:17 PM | #8 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
I'd suggest you go read the tutorial. While you seem to have a basic grasp of regexes, there are some concepts you're not entirely clear on
You should pay special attention to the parts about quantifiers and backreferences |
04-30-2011, 07:22 PM | #9 | ||
Member
Posts: 13
Karma: 10
Join Date: Apr 2011
Device: nook
|
@Manichean : you're correct sir, i'm no programmer ;D but I read the tutorial to check if i could get it right.
@drmerry : that doesn't seem to work. Quote:
Quote:
but i'll keep investigating, thanks guys |
||
04-30-2011, 07:31 PM | #10 |
Well trained by Cats
Posts: 29,659
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
05-01-2011, 03:42 AM | #11 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
|
05-01-2011, 06:45 AM | #12 | |
Member
Posts: 13
Karma: 10
Join Date: Apr 2011
Device: nook
|
You're right, I guess what I tried to say I'm not very good at regexps.
Quote:
But I'm nowhere near implementing it. I've tried regexp coach as suggested in some other thread but it won't help me much, I think I don't understand the concept. |
|
05-01-2011, 07:53 AM | #13 |
Wizard
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
|
Hm. That ought to work. What are you getting in the destination field?
|
05-01-2011, 08:03 AM | #14 |
Grand Sorcerer
Posts: 11,691
Karma: 6240117
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
My understanding is that you want to process tag that are ISBNs, grab the value, and then put it into the identifiers field. This can be done with edit metadata search/replace. However ...
Assigning a 'multiple' column (tags) to a non-multiple column (isbn) can lead to unexpected behavior. Because the source field is multiple, search/replace processes each tag individually. The search & replace expressions alter the individual values before copy, then each tag value is added to the non-multiple identifier. This isn't what you want. Instead, you want the tags to be processes as a non-multiple so that the search, replace, and copy happens once per book. To do this, convert tags to a non-multiple column using the template feature, then extract the ISBN, then assign that extraction to the identifier. See the attached screen capture. |
05-05-2011, 08:20 AM | #15 |
Member
Posts: 13
Karma: 10
Join Date: Apr 2011
Device: nook
|
@chaley thanks, that worked
|
Tags |
regexp, series, title |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Different export filenames for series / non-series books? | HarryT | Calibre | 3 | 08-18-2010 12:30 PM |
Author, Series, Series #, Books | diokdin | Calibre | 19 | 05-14-2010 05:36 AM |
Pet peeve: series authors who introduce things in non-series books! | ficbot | Reading Recommendations | 12 | 02-06-2010 02:14 AM |
Parse book titles to fill in series in Calibre library | Marcika | Calibre | 1 | 11-25-2009 05:35 PM |
BAEN Free Library - Harrington series | JWLaRue | Upload Help | 59 | 03-10-2008 02:53 PM |