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 > Re: regexp_subs...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 6 Topic 6867 of 7280
Post > Topic >>

Re: regexp_substr help, please

by md <mardahl2000@[EMAIL PROTECTED] > Apr 29, 2008 at 09:52 AM

On Apr 29, 12:43 pm, yf...@[EMAIL PROTECTED]
 (Malcolm Dew-Jones)
wrote:
> Doug Miller (spamb...@[EMAIL PROTECTED]
) wrote:
>
> : 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
>
> [A-Z] doesn't match o

Here a perl test I did to check out a maybe.
@[EMAIL PROTECTED]
 is an array of your combos (did I get them all?)
The loop goes thru each.  $1 will contain the "last name".


@[EMAIL PROTECTED]
 = ("mc winter, first",
   "mc. winter, first",
   "winter, first",
   "mc winter,first",
   "mc. winter,first",
   "winter,first",
   "mc winter first",
   "mc. winter first",
   "winter first",
   );

foreach $x (@[EMAIL PROTECTED]
) {
  print qq/look at "$x"\n/;
  {
  $x =~ /(.*)?[, ]{1}[a-zA-Z]*$/;
  print $1 . "\n";
  }
}
 




 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
tan12V112 Wed Dec 3 0:24:37 CST 2008.