From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: andrew@tao11.riddles.org.uk
Subject: BUG #16133: Regexp quantifier issues
Date: Fri, 22 Nov 2019 20:08:55 +0000
Message-ID: <16133-a8934caee4e53035@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16133
Logged by: Andrew Gierth
Email address: andrew@tao11.riddles.org.uk
PostgreSQL version: 12.1
Operating system: any
Description:
(This started out as an irc discussion on #tcl that spilled over to
#postgresql:)
SELECT regexp_match('aaa', '(a*)*');
regexp_match
--------------
{aaa}
(1 row)
SELECT regexp_match('aaa', '(a*)+');
regexp_match
--------------
{""}
(1 row)
What seems to be happening here is that in the + case, the engine is doing
one more match, matching (a*) against an empty string at the end of the
input, unlike the * case where the last match of (a*) is against the whole
string. This seems to violate the rules for determining where subexpression
captures line up. (And certainly there is no justification for the + vs. *
quantifier to make any difference here.)
There are a large number of similar cases, but this seems to be the common
factor to all of them so far.
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, andrew@tao11.riddles.org.uk
Subject: Re: BUG #16133: Regexp quantifier issues
In-Reply-To: <16133-a8934caee4e53035@postgresql.org>
References: <16133-a8934caee4e53035@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