BUG #19104: Does regexp_substr function support non-greedy matching?

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: zoulx1982(at)163(dot)com
Subject: BUG #19104: Does regexp_substr function support non-greedy matching?
Date: 2025-11-05 12:41:30
Message-ID: 19104-c9e08a2693264d98@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19104
Logged by: lx zou
Email address: zoulx1982(at)163(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2025-11-05 13:01:16 Re: CREATE TABLE ... LIKE INCLUDING ALL does not create new sequences for serial columns
Previous Message Richard Guo 2025-11-05 10:19:15 Re: BUG #19102: Assertion failure in generate_orderedappend_paths with aggregate pushdown