Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id DDE801337B63 for ; Fri, 24 Sep 2010 08:34:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 38793-06 for ; Fri, 24 Sep 2010 11:34:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.4.227.11]) by mail.postgresql.org (Postfix) with ESMTP id B33371337B61 for ; Fri, 24 Sep 2010 08:34:32 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 9FB6FA28C; Fri, 24 Sep 2010 19:34:30 +0800 (WST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id A1AF6AE859; Fri, 24 Sep 2010 19:34:30 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id QHjXDsBdANwc; Fri, 24 Sep 2010 19:34:25 +0800 (WST) Received: from [10.1.1.5] (124-148-245-78.dyn.iinet.net.au [124.148.245.78]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 30319AE84E; Fri, 24 Sep 2010 19:34:25 +0800 (WST) Message-ID: <4C9C8CB4.3070205@postnewspapers.com.au> Date: Fri, 24 Sep 2010 19:34:12 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.12) Gecko/20100914 Thunderbird/3.0.8 MIME-Version: 1.0 To: Nicholas I CC: pgsql-sql@postgresql.org Subject: Re: find and replace the string within a column References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; 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: 201009/99 X-Sequence-Number: 34630 On 24/09/2010 5:15 PM, Nicholas I wrote: > Example: > table name person: > > name > ------------------------------------ > Samuel (S/o Sebastin ) > ------------------------------------- > > remove the word within the brackets. > the output should be , Samuel. Can't you just regexp_replace, matching \([^)]+\) (in other words "an open parenthisis, then a sequence of one or more of any character other than a close parenthesis, followed by a close parentheis) and replacing with an empty string ? -- Craig Ringer Tech-related writing at http://soapyfrogs.blogspot.com/