Brian <[EMAIL PROTECTED]> wrote:
>
> I'm way rusty on my regexp's (been on vacation for a month without doing
> any) but try this:
>
> $s =~ m/^([^,]+),\s*(\".+\>),(.+)/;
>
> $1 will be "[EMAIL PROTECTED]"
> $2 will be '"Blow, Joe" <[EMAIL PROTECTED]>'
> $3 will be "Joe Blow <[EMAIL PROTECTED]>"
>
> This will work as long as all the lines are in the format you gave
> earlier:
> $s = '[EMAIL PROTECTED], "Blow, Joe" <[EMAIL PROTECTED]>,Joe Blow
> <[EMAIL PROTECTED]>';
>
> If not, lemme know and I'll do my best (or somebody else will I'm sure)
> to come up with something a bit more forgiving. This regexp is really
> ugly and mean.
>
Actually, the string is a list of one or more email addresses where
each email address is
(1) an optional name, which, if it contains a comma, the whole thing is
quotes
(2) and an email address, possibly inside < >
Examples: Mike Miller <[EMAIL PROTECTED]>
"Miller, Mike" <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
[EMAIL PROTECTED]
And the addresses in the string are separated by a comma (or a comma and
whitespace).
This is why I'm been unable to come up with a regex.
:-)
Thanks,
-Mike
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]