Re: BUG #15046: non-greedy ignored
От
David G. Johnston
Тема
Re: BUG #15046: non-greedy ignored
Дата
Msg-id
CAKFQuwY-QAB7Gi+2q_m3SMFM4SQnXbDuk=vAERg0KL04LeiSiA@mail.gmail.com
Ответ на
BUG #15046: non-greedy ignored (PG Bug reporting form)
Список
Дерево обсуждения
BUG #15046: non-greedy ignored PG Bug reporting form <noreply@postgresql.org>
Re: BUG #15046: non-greedy ignored "David G. Johnston" <david.g.johnston@gmail.com>
Re: BUG #15046: non-greedy ignored Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #15046: non-greedy ignored Bob Gailer <bgailer@gmail.com>
On Friday, February 2, 2018, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:
Bug reference: 15046
Logged by: Bob Gailer
Email address: bgailer@gmail.com
PostgreSQL version: 10.1
Operating system: windows 10
Description:
I start psql; enter:
postgres=# select regexp_replace('a(d)s(e)f', '\(.*?\)', '', 'g');
regexp_replace
----------------
asf
(1 row)
Works as expected. Then I add |q to the pattern, and the .*? becomes
greedy!
postgres=# select regexp_replace('a(d)s(e)f', '\(.*?\)|q', '', 'g');
regexp_replace
----------------
af
(1 row)
This seems to be explained by the final greediness rule:
An RE consisting of two or more branches connected by the
|operator is always greedy.David J.
В списке pgsql-bugs по дате отправления