Re: regexp_replace not respecting greediness

From: Simon Ellmann <simon(dot)ellmann(at)tum(dot)de>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: regexp_replace not respecting greediness
Date: 2025-09-22 08:07:29
Message-ID: 0686ED8B-5A35-42E1-AF6A-DD1FD8C8C0F0@tum.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks for the hint to the documentation, I missed that part. This is really surprising behavior!

Cheers,
Simon

--

Research associate
Chair for database systems
Department of Informatics
TU München Tel: +49 89 289 17276
Boltzmannstr. 3 E-Mail: simon(dot)ellmann(at)tum(dot)de
D-85748 Garching bei München, Germany

On 19. Sep 2025, at 16:09, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

On Friday, September 19, 2025, Simon Ellmann <simon(dot)ellmann(at)tum(dot)de<mailto:simon(dot)ellmann(at)tum(dot)de>> wrote:
With the following regular expression, the second .* seems to match non-greedily although (if I am correct) it should match greedily:

Working as documented in rule 6:

https://www.postgresql.org/docs/current/functions-matching.html#POSIX-MATCHING-RULES

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Amit Kapila 2025-09-22 08:36:36 Re: Lock timeouts and unusual spikes in replication lag with logical parallel transaction streaming
Previous Message Tom Lane 2025-09-22 05:05:39 Re: coredump of language internal function