08-28-2011, 11:19 PM | #1 |
Junior Member
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
|
Regex Question involving multiple . (periods)
Sorry if this has been asked, but I've tried google and searching this forum and came up empty.
I'm trying to import books with author names with multiple periods in them, such as George R. R. Martin - Game of Thrones A. A. Attanasio - In Other Worlds A. Bertram Chandler - All Laced Up C. S. Friedman - The Wilding and none of them come up correctly. Any help is greatly appreciated. |
08-29-2011, 12:01 AM | #2 | |
Well trained by Cats
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Code:
\. |
|
Advert | |
|
08-29-2011, 01:04 AM | #3 | |
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
I use the following regex under Preferences - Adding Books for importing books with the author first. Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)\s*-\s*)?(?P<title>[^\-_0-9]+) Good Luck. |
|
08-29-2011, 11:02 AM | #4 |
Junior Member
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
|
I'm not replicating the success you're getting, but I think that's because I have a bigger problem.
Using the default regex to test in the test tool in Adding Books, I'm not even getting the right response for a basic Code:
(?P<title>.+) - (?P<author>[^_]+) gives me Title: No match Authors: Unknown I tried uninstalling/reinstalling the application, but that didn't help. Any ideas about this? Is something corrupt? |
08-29-2011, 11:12 AM | #5 | |
Well trained by Cats
Posts: 29,782
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Un-installing does not touch your settings or Library. Kill the configuration directory (after un-installing), then install to remove corrupted settings |
|
Advert | |
|
08-29-2011, 11:34 AM | #6 |
Junior Member
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
|
Thanks for the quick reply, but no dice.
It still doesn't work. |
08-29-2011, 11:57 AM | #7 |
Junior Member
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
|
New update.
The test function doesnt work, but actually importing the files come out correct. Thanks for the help everyone! |
08-29-2011, 03:24 PM | #8 | |
Junior Member
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
|
Quote:
Thanks for the last one. I got another one for you. I have another directory of books that go Rim Change - A. Bertram Chandler - Grimes 046 and I've modified your code to get title and author, but can't get series/index. I changed it to Code:
^(?P<title>[^\-_0-9]+)(\s*-\s*)((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)\s*-\s*)? becomes Title: test Authors: A. Bertram Chandler Series: No match Series index: No match Thanks again! |
|
08-29-2011, 04:34 PM | #9 |
Sigil & calibre developer
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
|
08-29-2011, 04:47 PM | #10 | ||
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
Rim Change - A. Bertram Chandler - Grimes 046.epub Adding the books extension allows you to use the test box successfully. Quote:
Try Code:
^((?P<title>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<author>[^\-_0-9]+)\s*-\s*)?(?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+) Last edited by DoctorOhh; 08-29-2011 at 05:05 PM. |
||
08-29-2011, 04:57 PM | #11 | ||
Junior Member
Posts: 7
Karma: 10
Join Date: Aug 2011
Device: Nook Color
|
Quote:
Quote:
Thanks again! That worked! I was able to edit the end so that the series was not necessary, but I still gotta study regex more to understand why I'm having such problems with the first two fields on my own. Edited one is: Code:
^((?P<title>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<author>[^\-_0-9]+))?(\s*-\s*(?P<series>[^0-9\-]+)(\s*-\s*)?(?P<series_index>[0-9.]+)?)? |
||
08-29-2011, 05:06 PM | #12 |
US Navy, Retired
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
You're welcome!
Also the Quick Preferences GUI plugin (see attached) allows you to quickly change add books settings from the toolbar without drilling down in the main preferences section. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Regex question and maybe some help | crutledge | Sigil | 9 | 03-10-2011 04:37 PM |
Regex Question | Archon | Conversion | 11 | 02-05-2011 10:13 AM |
The Watcher - An occult horror thriller involving an inhuman villain | brinlingfm | Self-Promotions by Authors and Publishers | 3 | 01-13-2011 04:15 AM |
Server maintenance involving E-Mail and Dev | Alexander Turcic | Announcements | 20 | 06-02-2010 06:36 PM |
Import files, regex question | al35 | Calibre | 0 | 03-22-2010 12:33 PM |