Re: Regex fails to capture group consisting of empty string in non-greedy case

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Regex fails to capture group consisting of empty string in non-greedy case
Date: 2026-12-02 22:52:23
Message-ID: 2026400.1796251943@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> On Wed, 2026-12-02 at 13:03 -0500, Tom Lane wrote:
>> Well, meh. Just because your LLM thinks this is a bug doesn't make
>> it one.

> The argument that convinced me was (adjusted from LLM's example to my
> own):
> The greedy form '^(a*)*\1$' matches. Greediness is supposed to
> decide which match is preferred, not whether there is one, so the two
> forms must agree on true/false.

Hmm, okay, that's a good argument. Objection withdrawn.

I'd still kick the other can down the road, unless someone comes up
with a much-less-improbable pattern that's affected.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Aman Ganapathy 2026-12-02 22:55:42 Re: BUG #19964: ltree GiST index returns too few rows for lquery with a {0,n} quantifier
Previous Message Zsolt Parragi 2026-12-02 22:41:07 Re: BUG #19872: JSON_TABLE: an UNUSED PASSING argument's COLLATE leaks into the output columns (wrong results, persi