RegExp help needed
Posted: Mon Aug 07, 2017 9:27 am
I've read the regexp tutorials but they do my head in and I've only gotten so far so I thought I'd yell for help.
I have a large(ish) collection of books stored on my hard drive and I want to import them into Calibre using their RegExp engine so I don't have to retype everything.
Given a filename formatting like this:
Abbey, Lynn - [Thieves World New Series 01] - Turning Points (v1.0) (html).rar
Using this expression:
(?P<author>.+) - (?P<series>.+) - (?P<title>.+)
I correctly get Author, Series and title into the program in the right fields.
However, I need to remove the square ([]) brackets from the series name and extract the series index into the correct calibre field from the series data and strip all the crap past the title.
They gave this as an example:
(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ?
Should I cut my wrists right now? (hopeful look)
I have a large(ish) collection of books stored on my hard drive and I want to import them into Calibre using their RegExp engine so I don't have to retype everything.
Given a filename formatting like this:
Abbey, Lynn - [Thieves World New Series 01] - Turning Points (v1.0) (html).rar
Using this expression:
(?P<author>.+) - (?P<series>.+) - (?P<title>.+)
I correctly get Author, Series and title into the program in the right fields.
However, I need to remove the square ([]) brackets from the series name and extract the series index into the correct calibre field from the series data and strip all the crap past the title.
They gave this as an example:
(?P<author>[^_-]+) -?\s*(?P<series>[^_0-9-]*)(?P<series_index>[0-9]*)\s*-\s*(?P<title>[^_].+) ?
Should I cut my wrists right now? (hopeful look)