JRS: In article <cs*******************@news.demon.co.uk>, dated Tue, 11
Jan 2005 15:06:32, seen in news:comp.lang.javascript, Iain Downie
<ia*********@bto.org> posted :
we are getting a few folk trying to register for our birdwatching surveys
with emails of the form: an***@phonecoop.coop, in other words with a 4
character ending (other examples are .info).
Currently, I use a regexp to check on 'normal' emails with 3 chars.....
Does anyone know of a similar function that can handle the type of e-mail I
described above with 4 chars?
Don't try to impose any restrictions on E-mail addresses unless you are
absolutely certain (and right) that those restrictions exist in the
applicable RFCs, AND that either those restrictions will remain for the
indefinite future or there will be someone able to perform the necessary
changes to your pages in a timely manner.
One cannot fully check an E-address, anyway; I could put an invalid one
on your form, send the form, and make the address valid later on; or
/vice versa/. For all bar about 2% of the time, the validity of
addresses @merlyn.dcu cannot be detected from outside this room.
Your users presumably supply an E-address because they need to receive
E-mail; getting it right is their responsibility, not yours.
What you can reasonably do is to check that they have not forgotten to
make an entry, and that they have not filled in the slot with something
quite different. A test for the presence of <something>@<something>.<so
mething> is suitable for that.
IMHO, you should allow anything that can be put in a mailer's FROM line
- for example, a full "Lady Ermintrude Q. Jones" <le*******@btu.urg>
or
le*******@btu.urg (Sir Zerubbabel Jones, M.P.) are IIRC
permissible; the comment field may be wanted at the recipient machine
for internal routing.
See <URL:http://www.merlyn.demon.co.uk/js-valid.htm>.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.