![]() |
#1 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: May 2012
Device: exPDF
|
![]()
Hello,
I'm having issues with adding books properly with regular expressions. Heres the filename: Lee Earle - Syzygy - The First Five Volumes.pdf Heres the regular expression: (?P<author>.+) - (?P<title>.+) Author should be "Lee Earle" and title "Syzygy - The First Five Volumes" Issue is Calibre sees author as "Lee Earle - Syzygy" and title as "The First Five Volumes" .... im having that issue with most of my files with two "-" (hyphen) in their filename. What am I doing wrong? Thanks ![]() |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,368
Karma: 78877538
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
(?P<author>[^-].+) - (?P<title>.+) should work
This changes the author search to look for a sequence of any characters that are not -'s. I think there are other approaches that should word as well (look for a discussion on Greedy / Lazy pattern matching). |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,726
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
I would just make your author expression non greedy in case you have a hyphenated author which would fail with PeterT's expression. Just involves adding one character...
i.e. (?P<author>.+?) - (?P<title>.+) |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,368
Karma: 78877538
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
LOL... I just wasn't fully sure on the non greedy....
|
![]() |
![]() |
![]() |
#5 |
Junior Member
![]() Posts: 4
Karma: 10
Join Date: May 2012
Device: exPDF
|
(?P<author>[^-]+) - (?P<title>.+)
Worked like a charm! Thanks for the help ![]() |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Directories and book import | JulioQc | Library Management | 3 | 05-02-2012 12:36 PM |
Import failed Error:404 when attempting to import from Calibre to Stanza | dvond | Apple Devices | 0 | 05-13-2011 03:00 PM |
Import book from Kobo Software Application | langis | Calibre | 1 | 11-18-2010 11:52 AM |
PDF import issue | Duiker | Calibre | 4 | 08-05-2010 08:58 AM |
PDF import bugs with Book Designer | JSWolf | Sony Reader | 5 | 04-26-2007 03:49 PM |