pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: Passing function parameters to regexp_replace
Date: Sat, 17 Sep 2011 18:34:29 +0000
Message-ID: <m38vpnt3uy.fsf@passepartout.tim-landscheidt.de> (raw)
References: <201109171321.43309.leif@solumslekt.org>
	<201109171331.58663.leif@solumslekt.org>
	<m3fwjvt7wo.fsf@passepartout.tim-landscheidt.de>
	<201109171927.56033.leif@solumslekt.org>

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




view thread (5+ messages)

Message-ID: <m38vpnt3uy.fsf@passepartout.tim-landscheidt.de>
Permalink:  ../m38vpnt3uy.fsf@passepartout.tim-landscheidt.de/
Also on:    postgresql.org/message-id/m38vpnt3uy.fsf@passepartout.tim-landscheidt.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tim@tim-landscheidt.de
  Subject: Re: Passing function parameters to regexp_replace
  In-Reply-To: <m38vpnt3uy.fsf@passepartout.tim-landscheidt.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox