Hi Roger,

Have you looked at the Email::Valid and Mail::Address modules? Mail::Address
will piece apart an email address (address, phrase, etc..) and Email::Valid can
do RFC822 some address validation (including MX host checking).

Cheers,
Kevin

On Tue, Feb 19, 2002 at 11:37:49AM -0800, Roger Morris ([EMAIL PROTECTED]) said 
something similar to:
> 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]

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
Is that a real poncho or a Sears poncho?
        -- Frank Zappa

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

Reply via email to