pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #19104: Does regexp_substr function support non-greedy matching?
2+ messages / 2 participants
[nested] [flat]
* BUG #19104: Does regexp_substr function support non-greedy matching?
@ 2025-11-05 12:41 PG Bug reporting form <noreply@postgresql.org>
2025-11-05 14:49 ` Re: BUG #19104: Does regexp_substr function support non-greedy matching? Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2025-11-05 12:41 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: zoulx1982@163.com
The following bug has been logged on the website:
Bug reference: 19104
Logged by: lx zou
Email address: zoulx1982@163.com
PostgreSQL version: 18.0
Operating system: Linux
Description:
When i use regexp_substr to process some text file, i found regexp_substr
does not support non-greedy match.
But fix the case again, i found maybe it support non-greedy, i don't hear
why the two cases get different results? or is it a regexp_substr bug ?
following is the test case:
ostgres=# SELECT regexp_substr('d.cook', '[a-z]+\.[a-z]{2,}?');
regexp_substr
---------------
d.cook
(1 row)
postgres=# SELECT regexp_substr('d.cook', '[a-z]\.[a-z]{2,}?');
regexp_substr
---------------
d.co
(1 row)
postgres=# select version();
version
--------------------------------------------------------------------------------
PostgreSQL 19devel on x86_64-pc-linux-gnu, compiled by gcc (GCC) 9.1.0,
64-bit
(1 row)
postgres=#
Thanks for your reading.
Regards.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #19104: Does regexp_substr function support non-greedy matching?
2025-11-05 12:41 BUG #19104: Does regexp_substr function support non-greedy matching? PG Bug reporting form <noreply@postgresql.org>
@ 2025-11-05 14:49 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2025-11-05 14:49 UTC (permalink / raw)
To: zoulx1982@163.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> When i use regexp_substr to process some text file, i found regexp_substr
> does not support non-greedy match.
Sure it does. But the details of the behavior are different from
Perl's engine in cases where you have both greedy and non-greedy
quantifiers (as your example does). Read the greediness rules here:
https://www.postgresql.org/docs/current/functions-matching.html#POSIX-MATCHING-RULES
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-11-05 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-11-05 12:41 BUG #19104: Does regexp_substr function support non-greedy matching? PG Bug reporting form <noreply@postgresql.org>
2025-11-05 14:49 ` Tom Lane <tgl@sss.pgh.pa.us>
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