Quote:
Originally Posted by Jellby
I think the problem is this (from the regular expressions reference):
The '*', '+', and '?' qualifiers are all greedy; they match as much text as possible. Sometimes this behaviour isn’t desired; if the RE <.*> is matched against '<H1>title</H1>', it will match the entire string, and not just '<H1>'. Adding '?' after the qualifier makes it perform the match in non-greedy or minimal fashion; as few characters as possible will be matched. Using .*? in the previous expression will match only '<H1>'.
So, just use:
(?P<author>[^_]+?) - (?P<title>.+)
|
My thanks and apologies. The expression
(?P<author>.+?) - (\[(?P<series>.+?) (?P<series_index>[0-9]+)\] - )?(?P<title>.+)
did work after all. I must've missed a character when I copied and pasted. Thank you.
However, the expression
(?P<author>[^_]+?) - (?P<title>.+)
does not work. It still drops the last word of the title.
Thanks again. You guys rule.