|08-01-2011, 12:33 PM||#1|
Join Date: Aug 2011
regex help please
i just discovered calibre and now i try to work into it, but regular expressions are a obstacle i can't break through until now. i have no clue about programming whatsoever and after hours of trying i give up. i have a huge collection of mainly scientific books, the filenames are in this format: <author> <year> <tiltle>, e.g. "tabachnick 2007 using multivariate statistics.pdf". what i want to do is to extract metadata from filenames. i used this regex: (?P<author>[^_]+) (?P<published>\d\d\d\d) (?P<title>.+). it correctly extracts author and title , but in the published-field it extracts 2007-07-31 any ideas what is wrong with the regex? thanks in advance!
|08-01-2011, 12:57 PM||#2|
Join Date: Sep 2009
Device: Sony PRS-350, PB360, Kobo Glo/AuraHD/Aura6"/AuraH2O/GloHD
I stand to be corrected but I'm not sure anything is wrong. The 'published' field is expecting a valid date. Your filename only contains the 'year' portion so Calibre has created the 'month' and 'day' portions as today's month and day.
|08-02-2011, 12:27 AM||#3|
US Navy, Retired
Join Date: Feb 2009
Location: North Carolina
Device: Nexus 7
If you change the Tweak to display the year only, you would only see 2007. It works for me, YMMV.
# Control how dates are displayed
gui_pubdate_display_format = 'yyyy'
|Thread Tools||Search this Thread|
|Thread||Thread Starter||Forum||Replies||Last Post|
|Regex||Faster||Sigil||2||04-24-2011 10:08 PM|
|regex replace???||schuster||Conversion||14||01-29-2011 10:02 AM|
|What a regex is||Worldwalker||Calibre||20||05-10-2010 06:51 AM|
|Help with a regex||A.T.E.||Calibre||1||04-05-2010 08:50 AM|
|Regex help...||Bobthebass||Workshop||6||04-26-2009 04:54 PM|