pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: zoulx1982@163.com
Subject: BUG #19104: Does regexp_substr function support non-greedy matching?
Date: Wed, 05 Nov 2025 12:41:30 +0000
Message-ID: <19104-c9e08a2693264d98@postgresql.org> (raw)

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.



view thread (2+ messages)  latest in thread

Message-ID: <19104-c9e08a2693264d98@postgresql.org>
Permalink:  ../19104-c9e08a2693264d98@postgresql.org/
Also on:    postgresql.org/message-id/19104-c9e08a2693264d98@postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, zoulx1982@163.com
  Subject: Re: BUG #19104: Does regexp_substr function support non-greedy matching?
  In-Reply-To: <19104-c9e08a2693264d98@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