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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: zoulx1982(at)163(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19104: Does regexp_substr function support non-greedy matching?
Date: 2025-11-05 14:49:56
Message-ID: 812834.1762354196@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Haiyang Li 2025-11-05 14:59:39 Re: BUG #19100: Different column type between partitioned table and detached pending partition table make errors
Previous Message Peter Eisentraut 2025-11-05 13:01:16 Re: CREATE TABLE ... LIKE INCLUDING ALL does not create new sequences for serial columns