=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> when I use setup_regexp_matches, I found matchctx->npatterns is always 1 no
> matter pattern have not or one subexpr subexpression.
It seems unlikely that this is a Postgres bug.
Just looking at the code in setup_regexp_matches, I wonder whether you
are passing use_subpatterns = true or not:
/* do we want to remember subpatterns? */
if (use_subpatterns && cpattern->re_nsub > 0)
{
matchctx->npatterns = cpattern->re_nsub;
pmatch_len = cpattern->re_nsub + 1;
}
else
{
use_subpatterns = false;
matchctx->npatterns = 1;
pmatch_len = 1;
}
regards, tom lane