Replacing characters in a string

From: Luís de Sousa <luis(dot)a(dot)de(dot)sousa(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Replacing characters in a string
Date: 2010-09-14 10:47:08
Message-ID: AANLkTinT1GDVOPCZ64eSKYo-6zwazeoc2uOvWjWQr8tG@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello everyone,

I need to replace all occurrences of a certain character in a string.
For that I'm using regexp_replace, but so far I only managed to
replace the first character, here's an example:

> SELECT regexp_replace('xaxx', 'x', 'e');
regexp_replace
----------------
eaxx
(1 row)

But the result I'd need is 'eaee'. How can I do it?

Thanks,

Luís

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2010-09-14 11:09:31 Re: Replacing characters in a string
Previous Message A B 2010-09-14 08:00:17 What filesystem to use for postgres?