Re: replace text function - Mailing list pgsql-general

From Joe Conway
Subject Re: replace text function
Date
Msg-id 3DC99CED.9040404@joeconway.com
Whole thread Raw
In response to Re: i have got an error  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
Mark Wilson wrote:
> Hi all,
>
> I'm trying to find a function that will replace one word with another in a
> string.
>
> e.g. select <replace function>('bob was here, bobina wasnt', 'bob', 'mike');
> will return "mike was here, mikeina wasnt"
>
> Is there such a function already written in PostGreSQL?
>

It is new in 7.3 (currently in beta). See the function called "replace" at:
http://developer.postgresql.org/docs/postgres/functions-string.html

test=# select replace('bob was here, bobina wasnt', 'bob', 'mike');
            replace
------------------------------
  mike was here, mikeina wasnt
(1 row)


HTH,

Joe




pgsql-general by date:

Previous
From: "Mark Wilson"
Date:
Subject: replace text function
Next
From: Darren Ferguson
Date:
Subject: Re: replace text function