At 08:02 PM 08/05/2001 -0400, Brett wrote:
>Quick question, I have this isEmail function below.  Should this cover
>the basis for verifying an email address or am i missing an possibility?
>
>
># input : scalar
># output: true or false
>sub isemail {
>    my($val) = shift(@_);
>    return 0 if (!defined($val));
>    return $val =~ /
>
^\w+(?:[\.-]?\w+)*@\w+(?:[\.-]?\w+)*(?:\.[a-zA-Z]{2,3}){1}$
>                      |
>                      ^\w+(?:[\.-]?\w+)*@(?:\d{1,3}\.){3}(?:\d{1,3}){1}$
>                   /x ? 1 : 0;
>}

Validating email addresses using regexps is really a futile exercise. It's,
for all intents and purposes, impossible. Theres a regexp which was
published in "Mastering Regular Expressions" which apparantly is as close
as you can get, but the regexp itself is 6,859 bytes long!

Most of this is covered in perlfaq(9). A better, more workable alternative
would be to check for a valid MX record for the given domain name. 

Aloha,
mel

--
mel matsuoka                    Hawaiian Image Productions
Chief Executive Alphageek              (vox)1.808.531.5474
[EMAIL PROTECTED]                  (fax)1.808.526.4040

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to