Re: Problem with replace - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Problem with replace
Date
Msg-id b42b73150701241851m247c5d27v1f2eccfb2c571edb@mail.gmail.com
Whole thread Raw
In response to Problem with replace  ("slawosz" <slawosz@gmail.com>)
List pgsql-general
On 23 Jan 2007 13:05:41 -0800, slawosz <slawosz@gmail.com> wrote:
> Hello,
> I have to relpace string
> http://example.com/index.php?module=articles&id= to string /module/ in
> whole column in table. How exacly use replace? I noob in postgres, I
> think it could be quite easy.
> Please, help

try replace command for simple things:
Administrator=# select replace ('abcdef', 'ab', '12');
 replace
---------
 12cdef
(1 row)

(to do the whole table, do:)
update foo set bar = replace(bar, ab, '12');

for more complex things use regex_replace() (see docs)

merlin

pgsql-general by date:

Previous
From: Ken Johanson
Date:
Subject: Re: Example of RETURNING clause to get auto-generated keys
Next
From: "Merlin Moncure"
Date:
Subject: Re: Idle in transaction - Explination ..