pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: zoulx1982@163.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19104: Does regexp_substr function support non-greedy matching?
Date: Wed, 05 Nov 2025 09:49:56 -0500
Message-ID: <812834.1762354196@sss.pgh.pa.us> (raw)
In-Reply-To: <19104-c9e08a2693264d98@postgresql.org>
References: <19104-c9e08a2693264d98@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





view thread (2+ messages)

Message-ID: <812834.1762354196@sss.pgh.pa.us>
Permalink:  ../812834.1762354196@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/812834.1762354196@sss.pgh.pa.us

 · 

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

* 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