Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Your patch has been added to the PostgreSQL unapplied patches list at:
>
> > a_ogawa00 wrote:
> >> This patch provides a new function regexp_replace.
> >> regexp_replace extends a replace function and enables text search
> >> by the regular expression. And, a back reference can be used within
> >> a replace string.
> >> (This patch for PostgreSQL 7.4.3)
>
> Don't we have this functionality already? It's even SQL-spec ...
Uh, all I see it replace(), which isn't regex:
<row>
<entry><literal><function>replace</function>(<parameter>string</parameter> <type>text</type>,
<parameter>from</parameter> <type>text</type>,
<parameter>to</parameter> <type>text</type>)</literal></entry>
<entry><type>text</type></entry>
<entry>Replace all occurrences in <parameter>string</parameter> of substring
<parameter>from</parameter> with substring <parameter>to</parameter>
</entry>
<entry><literal>replace( 'abcdefabcdef', 'cd', 'XX')</literal></entry>
<entry><literal>abXXefabXXef</literal></entry>
</row>
test=> SELECT replace('abc','a','d');
replace
---------
dbc
(1 row)
test=> SELECT replace('abc','[a-c]','d');
replace
---------
abc
(1 row)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073