JRS: In article <3f*********************@news.frii.net>, seen in
news:comp.lang.javascript, Mark Szlazak <ms******@aol.com> posted at
Sat, 12 Jul 2003 21:07:39 :-
Forgot one thing. If you only want international emails then modify the
regex to:
rxEmail =/^\w[-.\w]*\@[-a-b0-9]+(?:\.[-a-b0-9]+)*\.[a-z][a-z]\b/;
International does not mean foreign; it includes America. Indeed, the
OP seems to be Australian. Some US E-mail addresses end, I believe, in
..us, as is right and proper. Many non-US ones end in .com or .net, too.
The existence of a national indication in most cases implies a
significant connection with that country, with certain well-known
exceptions; the converse is not true.
Don't believe all that you read in books; even if it was good when
written, which is uncertain, the facts might have changed.
There is little point in doing much validation on an E-address.
It is *impossible* to tell, other than by hearing of delivery, that an
E-address is deliverable to; I can change the rules at this site while
not connected to the Net. Attempted exact validation risks false
negatives (so it needs to be possible to send to an address that the
test actually rejects) and false over-confidence.
ISTM that the only reasonable validation is one checking that the field
is non-empty and that its contents match the minimum requirements; that
will deal with cases where some other piece of information is entered.
/.+@/+\..+/ seems about as strong a test as is appropriate; if I have
it right, check for something @ something . something .
E-address validation must be a FAQ candidate; it could provide a basis
for an entry on RegExps.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.