View Single Post
Old 07-20-2010, 08:42 AM   #68
Barak
Junior Member
Barak began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jul 2010
Device: iPod Touch
Thanks for the try... unfortunately Calibre complainis that that is an invalid RexEx...

"ERROR: Invalid regular expression: redefinition of group name u'title' as group 10; was group 9"

EDIT: The following matches my first two formats, but bombs on the simple "Author Name - Book Title.ext" format.

(?P<author>[^_]+) - (?P<series>.+)( |(, Book #))(?P<series_index>[0-9]+) - (?P<title>.+)

2nd EDIT: Re-reading the entire thread I found GinoAMelone's post and added to it the specific bit I need to sort out the ",Book #" part and now it does everything I need it to!

^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?((?P<series>[^0-9\-]+)(\s*-\s*)?( |(, Book #))(?P<series_index>[0-9.]+)\s*-\s*)?(?P<title>[^\-_0-9]+)

Which matches the following:
Series Name 1 - Book Title.txt
Author - Series Name 1 - Book Title.txt
Author - Series Name, Book #1 - Book Title.txt
Author - Series Name - 1 - Book Title.txt
Author - Book Title.txt
Series Name - 1 - Book Title.txt

Last edited by Barak; 07-20-2010 at 12:31 PM. Reason: Followup
Barak is offline