> 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;