ok, perfect!
and if: my $str = '[EMAIL PROTECTED]<more email addresses, or may be none>;
and email separators are: ';' ',' '-' '_' 'white space/s' ???



-----Original Message-----
From: $Bill Luebkert [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 2:34 PM
To: Vitaly Sinitsin
Cc: [EMAIL PROTECTED]
Subject: Re: regular expression question


Vitaly Sinitsin wrote:
> 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.

my $str = '[EMAIL PROTECTED];[EMAIL PROTECTED]';
$str =~ /^.*?([\w\.-]+\@[\w\.-]+)\b/;
my $email = $1;

--
   ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic
http://www.todbe.com/


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to