Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B903A650EEB for ; Tue, 1 Jul 2008 18:24:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 99971-01-8 for ; Tue, 1 Jul 2008 18:24:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id AAED6650F22 for ; Tue, 1 Jul 2008 18:23:05 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Tue, 01 Jul 2008 16:23:03 -0500 Message-Id: <486A59E1.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0.3 Date: Tue, 01 Jul 2008 16:22:48 -0500 From: "Kevin Grittner" To: "Naomi Walker" , "pgsql-admin@postgresql.org" Subject: Re: Change a character in a text field References: <486A9A5E.9070905@mhs.mphasis.com> In-Reply-To: <486A9A5E.9070905@mhs.mphasis.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/18 X-Sequence-Number: 29628 >>> Naomi Walker wrote: > Is there some way with a SQL state to interrogate a text field, and > replace characters. > > For example, we would like all "|"'s to be changed to something else, on > a regular basis... It sounds like you might want to look at the regexp_replace function: http://www.postgresql.org/docs/8.3/interactive/functions-matching.html#FUNCTIONS-POSIX-REGEXP Be sure to use a WHERE clause on your UPDATE with the ~ operator. -Kevin