From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: zhq651@126.com
Subject: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
Date: Thu, 17 Jan 2019 01:30:03 +0000
Message-ID: <15595-e6317afee476db49@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15595
Logged by: Damion
Email address: zhq651@126.com
PostgreSQL version: 11.1
Operating system: linux
Description:
Hi,
when I use setup_regexp_matches, I found matchctx->npatterns is always 1 no
matter pattern have not or one subexpr subexpression.
so I can't tell whether there is a subexpression. see below:
if orig_str is '221133' & pattern is '11'
(gdb) p nth_subexpr
$23 = 1
(gdb) p matchctx->npatterns
$24 = 1
if orig_str is '221133' & pattern is '(11)'
(gdb) p nth_subexpr
$25 = 1
(gdb) p matchctx->npatterns
$26 = 1
if pattern is '((1)1)' or '((11))' (2 subexpression or more), I can kwown
how many subexpression by matchctx->npatterns .
postgres=# SELECT regexp_substr('221133', '((1)1)', 1, 1, 'i', 1);
(gdb) p matchctx->npatterns
$27 = 2
(gdb) p nth_subexpr
$28 = 1
Thanks.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, zhq651@126.com
Subject: Re: BUG #15595: matchctx->npatterns is always 1 no matter pattern have 0 or 1 subexpression
In-Reply-To: <15595-e6317afee476db49@postgresql.org>
References: <15595-e6317afee476db49@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox