On Fri, Dec 8, 2023 at 10:23 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
On Fri, Dec 8, 2023 at 9:14 PM <chris0e3@gmail.com> wrote:
>
>   setopt rematch_pcre
>   [[ 'REQUIRE. OPT' =~ 'REQUIRE.(\s*OPT)?' ]] && printf '\tA. ‹%s›\n' $match
>   [[ 'REQUIRE.'     =~ 'REQUIRE.(\s*OPT)?' ]] && printf '\tB. ‹%s›\n' $match

[...] I can reproduce your example with the most recent git checkout, as
well.  Oliver recently updated to pcre2, so if a patch appears, you
may be on your own to backport it.

This was easier to track down than I feared, but possibly difficult to handle correctly.
 
Is "unset match" OK here?  There doesn't seem to be an obvious way to distinguish "there are capture expressions, but none matched anything" from "there were no capture expressions".  Maybe Oliver has a better clue.