Hi,
In my opinion, it's easier with a split :
my $email = (split (';',$str))[0];
If you want to use your regex
$email = $1 if ($str =~ /^(.*?\@.*?\.(\w{3}|\w{2,3}\.\w{2})).*$/);
Marc Desfoss?s
-----Message d'origine-----
De: Vitaly Sinitsin [mailto:[EMAIL PROTECTED]]
Date: mercredi 2 octobre 2002 15:23
�: [EMAIL PROTECTED]
Objet: regular expression question
How can I get the first email address from the following string:
$str eq '[EMAIL PROTECTED];[EMAIL PROTECTED]';
I've got something like:
$str =~ /^.*\@.*\.(\w{3}|\w{2,3}\.\w{2})$/
but it retrieves only second email.
Thank's.
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs