Re: Replacing characters in a string

Поиск
Список
Период
Сортировка
От Sergey Konoplev
Тема Re: Replacing characters in a string
Дата
Msg-id AANLkTimB5YpJ2yXUMwCQSec3USpcs6QqQwOLjRNCaQw6@mail.gmail.com
обсуждение исходный текст
Ответ на Replacing characters in a string  (Luís de Sousa <luis.a.de.sousa@gmail.com>)
Ответы Re: Replacing characters in a string  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
2010/9/14 Luís de Sousa <luis.a.de.sousa@gmail.com>:
>> 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 specify 'g' as the flags parameter (the 4th one). It means 'globally'.

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

There are more of this flags described here:
http://www.postgresql.org/docs/8.4/interactive/functions-matching.html#POSIX-EMBEDDED-OPTIONS-TABLE

p.s. The question is for hackers - BTW I did not find 'g' in this
table, is it a docs bug?

>
> Thanks,
>
> Luís
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>



--
Sergey Konoplev

Blog: http://gray-hemp.blogspot.com /
Linkedin: http://ru.linkedin.com/in/grayhemp /
JID/GTalk: gray.ru@gmail.com / Skype: gray-hemp / ICQ: 29353802

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Replacing characters in a string
Следующее
От: Michele Petrazzo - Unipex
Дата:
Сообщение: Re: Replacing characters in a string