Re: Passing function parameters to regexp_replace - Mailing list pgsql-sql

From Tim Landscheidt
Subject Re: Passing function parameters to regexp_replace
Date
Msg-id m38vpnt3uy.fsf@passepartout.tim-landscheidt.de
Whole thread Raw
In response to Passing function parameters to regexp_replace  (Leif Biberg Kristensen <leif@solumslekt.org>)
List pgsql-sql
Leif Biberg Kristensen <leif@solumslekt.org> wrote:

> On Saturday 17. September 2011 19.07.03 Tim Landscheidt wrote:
>> Leif Biberg Kristensen <leif@solumslekt.org> wrote:

>> > UPDATE sources SET source_text = regexp_replace(source_text,
>> > E'n="(.*?)$1(.*?)"', E'n="\\1$2\\2"', 'g') where source_text like
>> > '%n="%$1%">%'

>> Try:
>> > UPDATE sources SET source_text = regexp_replace(source_text,
>> > CONCAT(E'n="(.*?)', $1, E'(.*?)"'), CONCAT(E'n="\\1', $2, '\\2"', 'g')
>> > where source_text like CONCAT('%n="%', $1, '%">%')

> The function CONCAT doesn't exist i PostgreSQL.

Eh, yes, of course.

>                                                 And I can't get it to work
> with EXECUTE and standard concatenation either:
> [...]

What do you need the EXECUTE for? Just drop it.

Tim



pgsql-sql by date:

Previous
From: Leif Biberg Kristensen
Date:
Subject: Re: Passing function parameters to regexp_replace
Next
From: boris
Date:
Subject: select xpath ...