Re: [GENERAL] Replacing characters in a string

2010-09-15 Thread Tom Lane
Sergey Konoplev writes: > 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-TAB

Re: [GENERAL] Replacing characters in a string

2010-09-14 Thread Luís de Sousa
Thank you for all the answers, several ways this can be made. 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

Re: [GENERAL] Replacing characters in a string

2010-09-14 Thread Szymon Guz
2010/9/14 Luís de Sousa > 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

Re: [GENERAL] Replacing characters in a string

2010-09-14 Thread Pavel Stehule
Hello 2010/9/14 Luís de Sousa : > 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_re

Re: [GENERAL] Replacing characters in a string

2010-09-14 Thread Thom Brown
2010/9/14 Luís de Sousa : > 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 >

Re: [GENERAL] Replacing characters in a string

2010-09-14 Thread Michele Petrazzo - Unipex
Luís de Sousa ha scritto: 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 ---

Re: [GENERAL] Replacing characters in a string

2010-09-14 Thread Sergey Konoplev
2010/9/14 Luís de Sousa : >> 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',

[GENERAL] Replacing characters in a string

2010-09-14 Thread Luís de Sousa
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