Re: Simple method to format a string

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: "ktm(at)rice(dot)edu" <ktm(at)rice(dot)edu>
Cc: Wes James <comptekki(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Simple method to format a string
Date: 2012-06-20 19:45:12
Message-ID: 4FE22848.5050309@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> 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
me the expecting result.

Thanks!
Emi

--
select
regexp_replace(
replace(
replace(col-val, ' ', ''), '-', ''),
.... replace...
'(...)', E'\\1 ', 'g')
from tn;

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Craig Ringer 2012-06-21 02:53:00 Re: Is there a similarity-function that minds national charsets?
Previous Message ktm@rice.edu 2012-06-20 18:21:43 Re: Simple method to format a string