![]() |
#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. |
![]() |
![]() |
![]() |
#2 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,021
Karma: 60358908
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 | |
|
![]() |
#3 | |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
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. |
|
![]() |
![]() |
![]() |
#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? |
![]() |
![]() |
![]() |
#5 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,021
Karma: 60358908
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 | |
|
![]() |
#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. |
![]() |
![]() |
![]() |
#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! |
![]() |
![]() |
![]() |
#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! |
|
![]() |
![]() |
![]() |
#9 |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
|
![]() |
![]() |
![]() |
#10 | ||
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
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. |
||
![]() |
![]() |
![]() |
#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.]+)?)? |
||
![]() |
![]() |
![]() |
#12 |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,896
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
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. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |