Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 85D2DB5DBDA for ; Thu, 30 Jun 2011 16:49:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 56193-01 for ; Thu, 30 Jun 2011 19:49:22 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from polaris.pinpointresearch.com (cerberus.pinpointresearch.com [66.7.238.130]) by mail.postgresql.org (Postfix) with ESMTP id 09E19B5DBDE for ; Thu, 30 Jun 2011 16:49:21 -0300 (ADT) Received: from betelgeuse.pinpointresearch.com (betelgeuse.pinpointresearch.com [192.168.1.179]) by polaris.pinpointresearch.com (Postfix) with ESMTP id CE74AE00EC82 for ; Thu, 30 Jun 2011 12:49:20 -0700 (PDT) Message-ID: <4E0CD340.30809@pinpointresearch.com> Date: Thu, 30 Jun 2011 12:49:20 -0700 From: Steve Crawford User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: How to remove a set of characters in text-columns ? References: <4E0CCE6F.70001@gmx.net> In-Reply-To: <4E0CCE6F.70001@gmx.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/101 X-Sequence-Number: 35567 On 06/30/2011 12:28 PM, Andreas wrote: > Hi, > 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 ? > > > regards > Look at regexp_replace() http://www.postgresql.org/docs/9.0/static/functions-string.html http://www.postgresql.org/docs/9.0/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP Cheers, Steve