Re: Replacing characters in a string

Поиск
Список
Период
Сортировка
От Thom Brown
Тема Re: Replacing characters in a string
Дата
Msg-id AANLkTimUN39268Dz8o_=tDtnZ9CwqE=RCbNp3u2_uwth@mail.gmail.com
обсуждение исходный текст
Ответ на Replacing characters in a string  (Luís de Sousa <luis.a.de.sousa@gmail.com>)
Список pgsql-general
2010/9/14 Luís de Sousa <luis.a.de.sousa@gmail.com>:
> 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?

Just remove the "regexp" bit:

SELECT replace('xaxx', 'x', 'e');

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

В списке pgsql-general по дате отправления:

Предыдущее
От: Luís de Sousa
Дата:
Сообщение: Replacing characters in a string
Следующее
От: Szymon Guz
Дата:
Сообщение: Re: Replacing characters in a string