Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 09-27-2010, 12:35 AM   #1
jhart711
Junior Member
jhart711 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2010
Device: nook
Regular Expression For Adding Books

I am trying to work out an expression for adding epub ebooks into Calibre, but I am going around in circles.

I am using this code for files in this format Title - Series - Author.

(?P<title>.+) -? (?P<series>[^_0-9-]*)(?P<series_index>[0-9]*) - (?P<author>[^_].+) ?

But is doesn't work when the series is missing.

Can someone please help?

John

Last edited by jhart711; 09-27-2010 at 12:42 AM.
jhart711 is offline   Reply With Quote
Old 09-27-2010, 01:50 AM   #2
megachirops
Enthusiast
megachirops began at the beginning.
 
Posts: 31
Karma: 12
Join Date: Mar 2010
Device: Kindle 2, Kindle 3
Code:
(?P<title>((?!\s-\s).)+)\s-\s(?:(?P<series>.+)\s(?P<series_index>\d+)\s-\s)?(?P<author>.+)
Give that a whirl.
megachirops is offline   Reply With Quote
Advert
Old 09-27-2010, 04:22 AM   #3
Manichean
Wizard
Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Manichean is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Manichean's Avatar
 
Posts: 3,130
Karma: 91256
Join Date: Feb 2008
Location: Germany
Device: Cybook Gen3
Quote:
Originally Posted by jhart711 View Post
(?P<title>.+) -? (?P<series>[^_0-9-]*)(?P<series_index>[0-9]*) - (?P<author>[^_].+) ?
I think you got too many whitespaces in there for it to work when the series is missing: You'd have to have three spaces between the title and the author in that case.
Manichean is offline   Reply With Quote
Old 09-27-2010, 06:51 AM   #4
jhart711
Junior Member
jhart711 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2010
Device: nook
That worked perfectly. Thanks.
jhart711 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre book adding: Regular expression request... Spiffy Calibre 34 01-19-2016 01:03 PM
Regular Expression Help Azhad Calibre 86 09-27-2011 02:37 PM
Regular Expression Help smartmart Calibre 5 10-17-2010 05:19 AM
Helping importing books using regular expression askyn Calibre 4 05-08-2010 01:06 AM
Help with the regular expression Dysonco Calibre 9 03-22-2010 10:45 PM


All times are GMT -4. The time now is 05:40 AM.


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