Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle regular experssion

Re: Oracle regular experssion

From: DA Morgan <damorgan_at_psoug.org>
Date: Sat, 03 Mar 2007 14:02:38 -0800
Message-ID: <1172959358.192517@bubbleator.drizzle.com>


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.org
Received on Sat Mar 03 2007 - 16:02:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US