Misbehaving non-greedy regexp
Given the following text
foo this bar that bar
and the regexp string "\\<foo\\>\\s-+.*?\\<\\(\\sw+\\)\\>\\s-+\\<bar\\>"
Expectation:
- the regexp matches
- subexpression 1 matches "this"
What actually happens:
- the regexp doesn't match at all
Changing the non-greedy operator *?
to greedy (*
) makes the regexp match, but of course subexpression 1 matches "that" instead.