On 4/15/02 10:38 PM, Timothy Johnson <[EMAIL PROTECTED]> wrote:

> I think the preferred way to do a negative match is with the !~ operator.
> 
> if( $email !~ /@/ )
> 
> at this point you don't really need to check if $email eq "", because if it
> does it will not have an @ in it.
> 
> I'm not sure, but you might also have to escape the @.

There's always

    unless ($email =~ /\@/){
        # invalid
    }
    else{
        # valid.
    }

Of course, that's sort of backwards logic.

Regexes do interpolate, so it certainly makes sense to escape the @.

I'll point out now that there was a discussion a while back on either
[EMAIL PROTECTED], [EMAIL PROTECTED], or [EMAIL PROTECTED] regarding
the validation of email addresses, and why it was basically impossible.

The best way to validate an email address remains to send an email to the
supplied address with a required activation code or the like. That way the
user can't use the service until they get their activation code, which is
the mailbox of the email address they specified. I'm not sure how valid that
is for your situation, though.

On 4/15/02 8:50 PM, bob ackerman <[EMAIL PROTECTED]> wrote:
> ...regilar expressions...

s/regilar/regular/;

:P

-- 
Michael


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

Reply via email to