I understand that ? can be used to make modifiers only match the first occurence and prevent the greediness, but maybe I've misunderstood how it's supposed to work. If the string is:
one two three four four four five six
...and I want to capture three
. I've been trying:
^one two (.*)(four)+?.*$
...but this gives me three four four
. What am I doing wrong? I've tried ??
and .?
and just (four)?
, but it's not working.