pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Leif Biberg Kristensen <leif@solumslekt.org>
To: pgsql-sql@postgresql.org
Subject: Re: Passing function parameters to regexp_replace
Date: Sat, 17 Sep 2011 13:31:58 +0200
Message-ID: <201109171331.58663.leif@solumslekt.org> (raw)
In-Reply-To: <201109171321.43309.leif@solumslekt.org>
References: <201109171321.43309.leif@solumslekt.org>

On Saturday 17. September 2011 13.21.43 Leif Biberg Kristensen wrote:

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

Sorry, I pasted a literal replacement, and substituted the parameters by hand. 
The expression should of course be 

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

regards, Leif



view thread (5+ messages)  latest in thread

Message-ID: <201109171331.58663.leif@solumslekt.org>
Permalink:  ../201109171331.58663.leif@solumslekt.org/
Also on:    postgresql.org/message-id/201109171331.58663.leif@solumslekt.org

 · 

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: leif@solumslekt.org
  Subject: Re: Passing function parameters to regexp_replace
  In-Reply-To: <201109171331.58663.leif@solumslekt.org>

* 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