From: | Simon Ellmann <simon(dot)ellmann(at)tum(dot)de> |
---|---|
To: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | regexp_replace not respecting greediness |
Date: | 2025-09-19 12:36:20 |
Message-ID: | 1B268DC1-F058-4243-B6F8-71451FB68F08@tum.de |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
With the following regular expression, the second .* seems to match non-greedily although (if I am correct) it should match greedily:
postgres=# SELECT REGEXP_REPLACE('jane(dot)smith(at)example(dot)com', '(dot)*?(at)(dot)*', 'ab');
regexp_replace
----------------
abexample.com
(1 row)
Other database systems (e.g., DuckDB, Umbra) match the whole input: https://analytics.db.in.tum.de/?q=SELECT+REGEXP_REPLACE%28%27jane.smith%40example.com%27%2C+%27.*%3F%40.*%27%2C+%27ab%27%29%3B
Affected version: PostgreSQL 17.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 15.2.1 20250813, 64-bit
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
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-09-19 14:09:43 | Re: regexp_replace not respecting greediness |
Previous Message | PG Bug reporting form | 2025-09-19 11:49:51 | BUG #19058: Empty repomd.xml.asc file |