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: Help with regular expression

Re: Help with regular expression

From: Mladen Gogala <gogala_at_sbcglobal.net>
Date: Sun, 25 Jun 2006 18:19:25 GMT
Message-ID: <pan.2006.06.25.18.19.24.661456@sbcglobal.net>


On Sun, 25 Jun 2006 05:28:10 -0700, Barry wrote:

> 10.2 RHL; Hi I am new to regular expressions. I am trying to get the
> second word from a sentence using a regular expression. The sentence
> uses '#' instead of spaces to make easy to read in
> comp.databases.oracle.server. My query almost does what I want, but it
> still has the word surrounded by '#'. Can someone help me with the
> regular expression to do the substring excluding the '#'. I know in the
> real system where I have spaces, I can use TRIM but instead I would
> rather have the regular expression right to start with and not have to
> do this.
> Thanks
> Barry
>
>
> SQL> SELECT REGEXP_SUBSTR('return#second#word#in#sentence','#[^#]*#')
> FROM DUAL;
> 2
> REGEXP_S
> --------
> #second#
>
>

Try with this:

SQL>
  1 SELECT
  2 REGEXP_SUBSTR('return#second#word#in#sentence','[^#]+',1,2)   3* from dual
SQL> / REGEXP



second

SQL>

-- 
http://www.mgogala.com
Received on Sun Jun 25 2006 - 13:19:25 CDT

Original text of this message

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