Quote:
Originally Posted by rollercoaster
@Starson17
thanks for the regex.. this is great..
can it be modified to ignore brackets around series like -
First last - (Series 1) - title.ext
First last - [Series 1] - title.ext
|
Yes. [\(\[]? means optional open parentheses or square brackets. Try this: (untested by me)
Code:
^((?P<author>([^\-_0-9]+)(?=\s*-\s*)(?!\s*-\s*[0-9.]+)|\b))(\s*-\s*)?([\(\[]?(?P<series>[^0-9\-]+) (- )?(?P<series_index>[0-9.]+)[\)\]]?\s*-\s*)?(?P<title>.+)
Quote:
and i dont know if it is possible but here it goes, can we use regex such that if author name has a coma it swaps first/last name. like -
First Last - title.ext -> Author name = "First Last"
Last, First - title.ext -> Author name = "First Last" instead of "Last, First"
Last, First M.- title.ext -> Author name = "First M. Last" instead of "Last, First M."
|
You can't use regex to do this - it has to be done in the code. I've considered writing code to do this (you''ll see a discussion of this in some of my posts), but haven't done it. Some author names have commas (Jr, the IIIrd) so that code could cause problems. I wrote code to swap at the comma to deal with authors who have middle names or middle initials, but I decided this autoswap would complicate things too much. (I'm really, really trying not to ask Kovid to add any more options. He's already added 3 for me. That's enough.)