Re: Validating email address
Re: Validating email address
- Subject: Re: Validating email address
- From: email@hidden (Randal L. Schwartz)
- Date: 02 Dec 2005 06:16:17 -0800
>>>>> "Bernardo" == Bernardo Hoehl <email@hidden> writes:
Bernardo> I just want to check if the address string "looks" valid, as you say:
Bernardo> "syntactically Valid".
Bernardo> Sorry for not explainning my self fully.
Beware of answers that use a regular expression that is less than
a page long. "Valid email address" is one of those cargo-culted answers
that seems to have a life of its own, usually generated by people
that have never heard of RFC822 (and 2822).
The shortest regular expression that can properly say "this is an
email address" can be found at
<http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html>, which is
describing a Perl module that can do the validation against that
regex. Even then, that regex doesn't handle comments within the email
address (that's stripped ahead), and the module doesn't handle
*nested* comments (which is a hard thing to do with a simple regex).
If you get any solutions that involve ^\w+@ as part of the answer,
feel free to make stupid noises in their general direction, and point
them at the above-referenced page. Also point them at RFC822,
which shows that addresses like:
fred&barney@ (the rockpile) stonehenge (dot-com!) . (that was dot) com
are perfectly valid, and in fact will deliver to an autoresponder that
I've set up for just such an example.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<email@hidden> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden