Rob Dixon schreef:

> [academica]
> my ($user) = ($email =~ /(.+?)[EMAIL PROTECTED]/);
>
> which would put the part of the email up to the 'at' sign into $user.
> But there's no need to match anything after the at, so you could write
>
> my ($user) = ($email =~ /(.+?)\@/);

Email addresses can have many different layouts:

  $email = q{user @ example.com <[EMAIL PROTECTED]>};

  $email = q{"user \"@\" example.com" [EMAIL PROTECTED];

  $email = q{<user456 @ host.example.com>};

  $email = q{<user456(comment \) still comment)@host.example.com>};

(I am not completely sure that all of them are valid under RFC 2822)

So yes, please use Email::Address, or Regexp::Common.

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to