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";
}
}


|