Quote:
Originally Posted by Shadewing
The books are all in txt format and come with names in of 3 formats:
Author - Title.txt
Author - Series - Title.txt
Author - Series - Series No. - Title.txt
|
Yeahhhhh!
This regex WILL do exactly what you want.
(?P<author>[^_-]+)\s*-\s*((?P<series>[^_0-9-]*)\s*-\s*)?((?P<series_index>[0-9]*(.?[0-9]*))?\s*-\s*)?(?P<title>[^_].+)
Author AND Title MUST be there!
Series and/or Series no may be there or not or one or the other.
The series no can have a decimal in it. I think 2.5 is a book later added between 2 and 3?
If only one of series or series no is present, I suspect Calibre knows which is which from the fact that the series no is numeric.
The author is transfered as entered but Calibre has an option to swap firstname and lastname.