Java Mailing List Archive

http://www.dba.5341.com/

Home » Home (12/2007) » oracle-l »

Re: String Manipulation

Jared Still

2007-05-17

Replies:


On 5/17/07, Jeremiah Wilton <jeremiah@ora-600.net> wrote:
A regex returning the first word from the address should do it:

SQL> select regexp_substr('foo.bar.baz','\w*') from dual;



16:32:27 SQL>l
  1* select regexp_substr(' foo-1.bar.baz','[a-z|A-Z|0-9|-]*') from dual
16:32:28 SQL>/

REGEX
-----
foo-1

1 row selected.

There's probably a metacharacter to shorten that regex, but I can't
remember and too lazy to look.

--
Jared Still
Certifiable Oracle DBA and Part Time Perl Evangelist

©2008 dba.5341.com - Jax Systems, LLC, U.S.A.