Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 11-07-2015, 07:30 PM   #1
anonymust
Book Reader
anonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavens
 
anonymust's Avatar
 
Posts: 43
Karma: 13674
Join Date: Aug 2015
Location: Earth
Device: Pocketbook *** (Touch HD 3)
Question 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.
anonymust is offline   Reply With Quote
Old 11-07-2015, 07:51 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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]+)]
eschwartz is offline   Reply With Quote
Advert
Old 11-07-2015, 08:11 PM   #3
anonymust
Book Reader
anonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavens
 
anonymust's Avatar
 
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:
calibre, version 2.42.0
ERROR: Invalid regular expression: Invalid regular expression: unbalanced parenthesis
* * * * 8 *
Quote:
Originally Posted by eschwartz View Post
Your "published" capture group is empty.

You want:
Code:
(?P<author>[^_]+) - (?P<title>.+) [(?P<published>[0-9]+)]
anonymust is offline   Reply With Quote
Old 11-07-2015, 08:53 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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
then saw
Code:
+)]
with no opening parenthesis anywhere in sight.

Last edited by eschwartz; 11-07-2015 at 08:58 PM.
eschwartz is offline   Reply With Quote
Old 11-08-2015, 02:00 PM   #5
anonymust
Book Reader
anonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavensanonymust is a rising star in the heavens
 
anonymust's Avatar
 
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:
"
and apostrophes':
Quote:
'
But now I see its the backslash
anonymust is offline   Reply With Quote
Advert
Old 11-08-2015, 05:07 PM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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.
eschwartz is offline   Reply With Quote
Reply

Tags
adding books tags, published date, year


Forum Jump

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


All times are GMT -4. The time now is 06:18 AM.


MobileRead.com is a privately owned, operated and funded community.