Quote:
Originally Posted by MSWallack
Brilliant! Perfect! Bravo!
Seriously, thank you very much. This worked perfectly. Now if I can just try to figure out what you've done so that I can try to edit my own expressions... I looked at the page that Calibre links to but it wasn't terribly comprehensible. Do you know of an easier, more straightforward guide to regular expressions?
|
That one is a bit intimidating. It's got a lot of options that you don't need if your books are named the way you said. For example, I made the # optional in front of your series number.
There are too many regex guides for me to point to any single one. Google is your friend, but basically, here's what I did:
This part says stop matching the title when you find a closed square bracket or open parentheses or hyphen or underscore.
(?P<title>([^\-_\[\(]+))
Then there's a space and a required open square bracket before this:
(?P<series>[^0-9\-]+)
which is the series. The series matches until it sees a number or hyphen.
A lot of the backslashes are "escaping" characters like parentheses or hyphens or brackets. It takes some practice to read one you didn't write yourself. Sometimes it's easier to start with your own.
This part is an optional hyphen and space so you can optionally have space hyphen space in front of your series_id
(- )?
This part is the optional pound sign (looking closely, I see that I escaped it, but that was unnecessary, I was in a hurry).
\#?