Skip site navigation (1) Skip section navigation (2)

Re: Passing function parameters to regexp_replace

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Passing function parameters to regexp_replace
Date: 2011-09-17 18:34:29
Message-ID: m38vpnt3uy.fsf@passepartout.tim-landscheidt.de (view raw or flat)
Thread:
Lists: pgsql-sql
Leif Biberg Kristensen <leif(at)solumslekt(dot)org> wrote:

> On Saturday 17. September 2011 19.07.03 Tim Landscheidt wrote:
>> Leif Biberg Kristensen <leif(at)solumslekt(dot)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


In response to

pgsql-sql by date

Next:From: Rob SargentDate: 2011-09-19 14:49:20
Subject: Re: select xpath ...
Previous:From: borisDate: 2011-09-17 17:48:03
Subject: select xpath ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group