REGEXP_REPLACE woes - Mailing list pgsql-general

From Leif B. Kristensen
Subject REGEXP_REPLACE woes
Date
Msg-id 200806101328.07031.leif@solumslekt.org
Whole thread Raw
Responses Re: REGEXP_REPLACE woes  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
I want to transform the text '[p=1242|John Smith]' to
<a href="./family.php?person=1242">John Smith</a>, but what I get is:

pgslekt=> select REGEXP_REPLACE('[p=1242|John Smith]',
pgslekt(> E'[p=(\d+)|(.+?)]',
pgslekt(> E'<a href="./family.php?person=\\1">\\2</a>');
                    regexp_replace
------------------------------------------------------
 [<a href="./family.php?person="></a>=1242|John Smith]
(1 row)

What am I doing wrong?

PostgreSQL 8.2.7 on i686-pc-linux-gnu BTW.
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
My Jazz Jukebox: http://www.last.fm/user/leifbk/

pgsql-general by date:

Previous
From: IPS
Date:
Subject: Query on Oracle 10g Merge Function equivalent command/function in Postgre
Next
From: Nikola Milutinovic
Date:
Subject: Re: Multithreaded queue in PgSQL