Re: [SQL] Simple method to format a string

2012-06-20 Thread Emi Lu
Just a small optimization would be to use a backreference with regexp_replace instead of regexp_matches: select regexp_replace('foobarbaz', '(...)', E'\\1 ', 'g'); regexp_replace foo bar baz Great. After combined with several more replace(s), regexp_replace will provide

Re: [SQL] Simple method to format a string

2012-06-20 Thread k...@rice.edu
On Wed, Jun 20, 2012 at 12:08:24PM -0600, Wes James wrote: > On Wed, Jun 20, 2012 at 8:42 AM, Emi Lu wrote: > > > Good morning, > > > > Is there a simply method in psql to format a string? > > > > For example, adding a space to every three consecutive letters: > > > > abcdefgh -> *** *** *** > >

Re: [SQL] Simple method to format a string

2012-06-20 Thread Wes James
On Wed, Jun 20, 2012 at 8:42 AM, Emi Lu wrote: > Good morning, > > Is there a simply method in psql to format a string? > > For example, adding a space to every three consecutive letters: > > abcdefgh -> *** *** *** > > Thanks a lot! > Emi > > I looked at "format" here: http://www.postgresql.org

[SQL] Simple method to format a string

2012-06-20 Thread Emi Lu
Good morning, Is there a simply method in psql to format a string? For example, adding a space to every three consecutive letters: abcdefgh -> *** *** *** Thanks a lot! Emi -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgres