Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Regex Unexplained Failure

by december (Pilgrim)
on Aug 04, 2002 at 03:56 UTC ( [id://187450]=note: print w/replies, xml ) Need Help??


in reply to Regex Unexplained Failure

Hmm... That regexp looks broken, i.e. it doesn't work in valid situations (as others already told you).

I use something like:

/^[a-z0-9-_.]+@[a-z0-9-.]*[a-z0-9]\.[a-z]{2,4}$/i
... for simple checks. This just requires to have something 'legal' in front of the '@', a basic check for valid chars in the domain name (A-Z0-9 + underscore, except first and last character can not be an underscore), and then 2-4 chars for the tld. This doesn't really catch all invalid situations, but if you would really want to do that, you might as well resolve the mx/a records for the domain given to check if it exists, and then even try to do a VRFY/EXP check on the mailserver. I'm just saying, if people want to give a fake address, they will, even if it's just that of someone else :)


   wouter

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://187450]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found