Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: String Manipulation
Even better. Thanks Carel-Jan.
On 5/18/07, Carel-Jan Engel <cjpengel.dbalert_at_xs4all.nl> wrote:
>
> If the first occurrence of the delimiter is the position you want to go
> to, take any character that is not the delimiter:
>
>
> - For a delimiter '.', we want any not-dot: ^.
> - We want that as many times as possible: [^.]*
>
>
> 1* select regexp_substr('test1@#!$%.test2.com', '[^.]*') from dual
> dbalert199.D10B.1.FOTDBA SQL> /
> REGEXP_SUB
> ==========
> test1@#!$%
>
> HTH
>
>
> Best regards,
>
> Carel-Jan Engel
>
> ===
> If you think education is expensive, try ignorance. (Derek Bok)
> ===
>
> On Thu, 2007-05-17 at 16:34 -0700, Jared Still wrote:
>
>
> On 5/17/07, *Jeremiah Wilton* <jeremiah_at_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
>
>
>
>
-- Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist -- http://www.freelists.org/webpage/oracle-lReceived on Fri May 18 2007 - 12:34:23 CDT
![]() |
![]() |