regexp_replace

From: polen(dot)t2006(at)freenet(dot)de
To: pgsql-general(at)postgresql(dot)org
Subject: regexp_replace
Date: 2007-07-23 14:50:35
Message-ID: 1185202235.569654.243430@n2g2000hse.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I would like to change a sub-string in a text-field by using

UPDATE tablename SET
fieldname=regexp_replace(fieldname,old_sub_string,new_sub_string)
WHERE (fieldname like '%old_sub_string%')

In priniciple, it works. However, only one occurence of old_sub_string
is replaced and further not. Which syntax has to be used to replace
all old_sub_strings by new_sub_string in a text-field at once? I have
seen something like '\&' in the docs and tried it, but I failed.

Any Idea? Thanks a lot!

Ciao,
Tino

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2007-07-23 15:29:35 Re: Import to excel to postgres based website?
Previous Message Scott Marlowe 2007-07-23 14:13:41 Re: Need help with bash script and postgresql