Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle regular experssion
peterdempsey1_at_hotmail.co.uk wrote:
> Hello, in my query the # are really spaces.
>
> My question is in regexp_replace, is there a way to remove the leading
> #'s as well.
>
> select regexp_replace('a#b#cde#fghi#j','[a-z]+','',1,1) from dual;
> select regexp_replace('a#b#cde#fghi#j','[a-z]+','',1,2) from dual;
>
>
> You can see one of the first query result has a leading #. I am
> thinking that I have to "select trim(regexp_replace( etc))"
> Is that right?
>
> Thank you for your help.
>
> Peter G. Dempsey
>
>
> What I see is below (10.2 on Solaris 10 V210)
>
> SQL>
> SQL>
> SQL> select regexp_replace('a#b#cde#fghi#j','[a-z]+','',1,1) from
> dual;
> select regexp_replace('a#b#cde#fghi#j','[a-z]+','',1,2) from dual;
>
> REGEXP_REPLAC
> -------------
> #b#cde#fghi#j
>
> SQL>
> REGEXP_REPLAC
> -------------
> a##cde#fghi#j
select TRIM(regexp_replace('a#b#cde#fghi#j','[a-z]+','',1,1)) from dual;
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Sat Mar 03 2007 - 16:02:38 CST