Re: regexp_replace not respecting greediness

Simon Ellmann <simon.ellmann@tum.de>

From: Simon Ellmann <simon.ellmann@tum.de>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2025-09-22T08:07:29Z
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.ellmann@tum.de
D-85748 Garching bei München, Germany

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

On Friday, September 19, 2025, Simon Ellmann <simon.ellmann@tum.de<mailto:simon.ellmann@tum.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.