View Single Post
Old 08-13-2009, 12:45 PM   #11
oldcrow74 began at the beginning.
Posts: 15
Karma: 10
Join Date: May 2009
Device: sony prs-700bc
Originally Posted by Jellby View Post
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.
oldcrow74 is offline   Reply With Quote