From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: How to remove a set of characters in text-columns ?
Date: Fri, 01 Jul 2011 02:17:55 +0000
Message-ID: <m37h82lp64.fsf@passepartout.tim-landscheidt.de> (raw)
References: <4E0CCE6F.70001@gmx.net>
(anonymous) wrote:
> how can I remove a set of characters in text-columns ?
> Say I'd like to remove { } ( ) ' " , ; . : !
> Of course I can chain replace ( replace ( replace ( replace
> ( ... , '' ) .... and replace the chars one by one against
> an empty string ''.
> There might be a more elegant way.
> Is there ?
Besides the regexp_replace() solution mentioned by Charlie
and Steve, you can also use TRANSLATE():
| tim=# SELECT TRANSLATE('a{b''c"d!f', '{}()''",;.:!', '');
| translate
| -----------
| abcdf
| (1 Zeile)
| tim=#
Tim
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: How to remove a set of characters in text-columns ?
In-Reply-To: <m37h82lp64.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