Regex assistance request - importing books.
Dear all,
I'm having some trouble with complex book titles, such as this fictional example:
Some Author - Ancient Egypt BC 3000-732 - The Sixth Dynasty BC 2345-2181
In Calibre three first columns are Title, Author, Series and the title above ends up like this:
Ancient Egypt BC | Some Author | -nothing-
when I want it to end up thus:
The Sixth Dynasty BC 2345-2181 | Some Author | Ancient Egypt BC 3000-732
Sadly my brain is biologically incompatible with everything to do with scripts, programming and such, so I haven't a clue what's going on. The regex script I use was copied from an old post here and I quite frankly have no idea how it does what it does. I just use it because it works just fine with most books and better than the other scripts I tried.
The script is:
(?P<author>[a-zA-Z&' \.]+?) - \[?((?P<series>[a-zA-Z' ]+) (?P<series_index>[0-9\.]+)\]? - )?(?P<title>[a-zA-Z,'\.\- ]+).*
It's hardly a big deal, but it would be very cool if it could be made to work and if some kind soul could give me some guidance I'd be very grateful.
|