Search Postgresql Archives

Re: Replacing characters in a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





2010/9/14 Luís de Sousa <luis.a.de.sousa@xxxxxxxxx>
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?


Hi,
try this one:

SELECT regexp_replace('xaxx', 'x', 'e', 'g');

regards
Szymon Guz 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux