11-07-2015, 07:30 PM | #1 |
Book Reader
Posts: 43
Karma: 13674
Join Date: Aug 2015
Location: Earth
Device: Pocketbook *** (Touch HD 3)
|
Adding Books RegExp date/year)
Im having a hard time getting the regular expressions right for Adding Books> Configure metadate from file name
Im basically trying to get this to work Code:
(?P<author>[^_]+) - (?P<title>.+) [(?P<published>)] Sample for an input file would be: AuthorsName - TitleBook [yearNumber].epub another: Bill Gates - Using Windows 10 [2015].epub yearnumber being a 4 digit field. ** please take note that the year is between two square brackets. |
11-07-2015, 07:51 PM | #2 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
Your "published" capture group is empty.
You want: Code:
(?P<author>[^_]+) - (?P<title>.+) [(?P<published>[0-9]+)]
|
Advert | |
|
11-07-2015, 08:11 PM | #3 | |
Book Reader
Posts: 43
Karma: 13674
Join Date: Aug 2015
Location: Earth
Device: Pocketbook *** (Touch HD 3)
|
When I do that i get this error message.
Quote:
|
|
11-07-2015, 08:53 PM | #4 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
That is because I took a look at one error you made, and completely forgot to fix (or indeed notice) the other one. I assumed the only error was the "it doesn't find the date" one, didn't even notice there was a formatting error as well.
Since I am presenting myself as a help guru, that is rather embarrassing. You need to escape the brackets surrounding the date, or else it tries to read that as another character set. Code:
(?P<author>[^_]+) - (?P<title>.+) \[(?P<published>[0-9]+)\] EDIT: In case you are interested, "unbalanced parentheses" -- the parser is dumb enough that it took a look at the character set: Code:
(?P<published>[0-9 Code:
+)] Last edited by eschwartz; 11-07-2015 at 08:58 PM. |
11-08-2015, 02:00 PM | #5 | ||
Book Reader
Posts: 43
Karma: 13674
Join Date: Aug 2015
Location: Earth
Device: Pocketbook *** (Touch HD 3)
|
Thanks Guru
I was almost close to figuring out the bracket thing myself... but I went with Quotation marks: Quote:
Quote:
|
||
Advert | |
|
11-08-2015, 05:07 PM | #6 |
Ex-Helpdesk Junkie
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
You're welcome.
In case you're interested, a general guide to Regular Expressions: http://www.regular-expressions.info The same website that taught me everything I know about them. Very helpful walkthroughs. |
Tags |
adding books tags, published date, year |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
calibre regexp for adding books | garberw | Library Management | 9 | 08-29-2015 07:36 PM |
Regexp for adding books failing | nvcleemp | Library Management | 10 | 08-29-2015 02:23 AM |
Date updating when adding books (and overwrite duplicates) | Pepin33 | Library Management | 11 | 08-07-2012 09:16 AM |
Import OS modify date while Adding books? | unboggling | Calibre | 4 | 12-07-2011 12:09 PM |
Date in Calibre? Adding books in the future? | wygit | Calibre | 2 | 11-04-2009 11:12 AM |