Help with regular expressions for adding books
I have a large group of old books without metadata that have good file names, I want to import them without messing up the Author and Title so I can use it to get the rest of the info from the 'Download Metadata & Cover's'. Every expression I try seems to mess up some of them. The books are all in the format:
Author - Series - Title.ext OR Author - Title.ext
I've been trying to write a simple regex to catch all the characters before the first " - " as the Authors name, no matter what it contains. and everything after the last " - " as the Title, no matter what it contains, and everything in between as the series info, if present.
This works as long as there's a Series but fails if not, and I cant seem to make the series optional:
^(?P<author>.+) - (?P<series>.*) - (?P<title>.+)
Can anyone help please, thanks.
|