> I am using following code to validate e-mail addresses
> 
> if ($mail =~ m/^(\w+(\.|-))*\w+\@(\w+(\.|-)*)+\w+$/){
>         valid
> }else{
>     invalid
> }
> 
> it will give valid results for all of the following e-mail address
> 
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
> 
> 
> ...
> 
> but I am not sure about the illegal chars for an e-mail address
> can someone check above code tell me whether this matches all the valid
> e-maill
> address and only the valid e-mail addresses.
> 

Use the Email::Valid module from CPAN.  If you are curious about how
complex an email address can truly get check out the source for the
module. I believe it is mostly taken from the regex provided in the
appendix of the Mastering Regular Expressions O'Reilly book.  It will
truly blow your mind...

http://danconia.org


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


Reply via email to