For example, matching "aba" against the pattern / ^(a(b) ?)+$ / sets $2 to the value "b", but matching "aabbaa "against / ^(aa(bb)? )+$ / leaves $2 unset.
PCRE does not allow repeat quantifiers on lookahead assertions. Perl permits them, but they do not mean what you might think. For example, (?!a){3} does not assert that the next three characters are not "a". It just asserts that the next character is not "a" three times.