Re: Change a character in a text field

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Naomi Walker" <nwalker(at)mhs(dot)mphasis(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Change a character in a text field
Date: 2008-07-01 21:22:48
Message-ID: 486A59E1.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

>>> Naomi Walker <nwalker(at)mhs(dot)mphasis(dot)com> 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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Karen Stone 2008-07-01 23:00:15 Re: Change a character in a text field
Previous Message Naomi Walker 2008-07-01 20:58:06 Change a character in a text field