I've been working on email validation for a script.  The examples I've seen 
haven't exactly done that great of a job.  I've taken the code and messed 
with it some.
My thoughts were, if the email is in the correct format, 
ie  [EMAIL PROTECTED]  or some form like   [EMAIL PROTECTED]  then go 
to the second 'if' statement and check for bad characters.
It seems to work how I want, have I caught most of the problems?   I'm only 
interested in the email address, not checking to see if this is 
valid:  "roger" <[EMAIL PROTECTED]>


sub  valid_email ()
{
if ($e_address =~ /^\w+(\.\w+){0,}\@\w+(\.\w+){1,}$/i)
        {
        if ($e_address =~ /\'\{\}\[\]\(\)\$\%\&\\\*/i)
        {       
                return 0;
        }
        return 1;
        }
        return 0;
}




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

Reply via email to