Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > regexp_substr h...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 6867 of 6990
Post > Topic >>

regexp_substr help, please

by spambait@[EMAIL PROTECTED] (Doug Miller) Apr 29, 2008 at 03:34 PM

I need to be able to pull just the last name out of a string consisting of 
lastname and firstname, separated by a comma, or space, or comma and
space. 
Complicating matters somewhat is the fact that lastname might be something

like "Mc Kay" or "St. Louis" so simply grabbing everything before the
first 
space isn't sufficient.

The closest I've come so far is
        select regexp_substr ('St. Louis, Ted', '.{4}[A-Z]+') from dual;
but this returns only
        St. L

I thought regular expression matching was supposed to be "greedy", and
take as 
many characters as would satisfy the pattern ("St. Louis" in this case).

What am I doing wrong?
 




 6 Posts in Topic:
regexp_substr help, please
spambait@[EMAIL PROTECTED  2008-04-29 15:34:24 
Re: regexp_substr help, please
md <mardahl2000@[EMAIL  2008-04-29 09:33:53 
Re: regexp_substr help, please
yf110@[EMAIL PROTECTED]   2008-04-29 09:43:23 
Re: regexp_substr help, please
spambait@[EMAIL PROTECTED  2008-04-29 16:56:40 
Re: regexp_substr help, please
md <mardahl2000@[EMAIL  2008-04-29 09:52:28 
Re: regexp_substr help, please
Peter Nilsson <airia@[  2008-04-29 20:17:57 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 17:13:05 CDT 2008.