Re: REGEXP_REPLACE doesn't comply with the standard, does it ?

From: Peter Nilsson <airia_at_acay.com.au>
Date: Tue, 29 Jun 2010 23:16:53 -0700 (PDT)
Message-ID: <7f3ce732-335a-4442-ba6b-e47ebd108527_at_n19g2000prf.googlegroups.com>



On Jun 30, 6:44 am, joel garry <joel-ga..._at_home.com> wrote:
> On Jun 29, 5:06 am, Spendius <spend..._at_muchomail.com> wrote:
> > The following works *everywhere* I've ran it:
> > $ echo rbcde_fghijkl_mnopq|sed "s/_\([a-z]\)/\u\1/g"
> > rbcdeFghijklMnopq

<snip>
> > I've found no way to have the same behaviour using
> > REGEXP_REPLACE:
> > SQL> select regexp_replace('rbcde_fghijkl_mnopq','_\([a-z]
> > \)','\u\1')
> > from dual;
> > REGEXP_REPLACE('RBC
> > -------------------
> > rbcde_fghijkl_mnopq
> >
> > How can you then obtain in SQL what I'm getting above in Ux ?
>
> Well, initcap seems to work with underscores, then you get rid
> of the underscores?
>
>   1  select
> replace(replace(initcap
> ('dummy'||'rbcde_fghijkl_mnopq'),'_',''),'Dummy','')
>   2* from dual
> JEG_at_TTST> /
>
> REPLACE(REPLACE(I
> -----------------
> rbcdeFghijklMnopq

Slightly simpler...

  select str,

         substr(replace(initcap('x' || str), '_', ''), 2)     from (

          select 'rbcde_fghijkl_mnopq' str from dual union all
          select '_xx_xx' str from dual
         );

--
Peter
Received on Wed Jun 30 2010 - 01:16:53 CDT

Original text of this message