Re: replace text function

From: Joe Conway <mail(at)joeconway(dot)com>
To: Mark Wilson <mark(at)mediasculpt(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: replace text function
Date: 2002-11-06 22:51:25
Message-ID: 3DC99CED.9040404@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Ferguson 2002-11-06 23:08:49 Re: replace text function
Previous Message Mark Wilson 2002-11-06 22:20:51 replace text function