View Single Post
Old 04-11-2010, 08:00 PM   #13
Spiffy
Groupie
Spiffy has a complete set of Star Wars action figures.Spiffy has a complete set of Star Wars action figures.Spiffy has a complete set of Star Wars action figures.Spiffy has a complete set of Star Wars action figures.Spiffy has a complete set of Star Wars action figures.
 
Posts: 160
Karma: 416
Join Date: Apr 2010
Device: Astak EZ Reader Pro AND Sony PRS-505
Quote:
Originally Posted by Starson17 View Post
(staggering a bit) ..... try this:
Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?(\[?(?P<series>[^0-9\-]+) (- )?(?P<series_index>[0-9.]+)\]?\s*-\s*)?(?P<title>[a-zA-Z1-9 ]+)(\(.*\))?$
It will have trouble with titles that have anything other than alphanumerics in the title.
Actually, I think I figured out one of the issues with this.

The regex works perfectly with any of this:

Quote:
L. Frank Baum - [Wizard of Oz 02] - The Marvelous Land of Oz.lit
L. Frank Baum - [Wizard of Oz 02] - The Marvelous Land of Oz(lit).lit
L. Frank Baum - Wizard of Oz 02 - The Marvelous Land of Oz(lit).lit
L. Frank Baum - Wizard of Oz 02 - The Marvelous Land of Oz.lit
But if somehow THIS makes it's way into the parsing, disaster results:

Quote:
L. Frank Baum - [Wizard of Oz 02] - The Marvelous Land of Oz[lit].lit
I think I had some unexpected files which were a bit messed up by using square brackets around the file type near the end rather than round ones. I probably just have to track those down "by hand".
Spiffy is offline   Reply With Quote