By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,316 Members | 1,342 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,316 IT Pros & Developers. It's quick & easy.

emails with 4 chars in suffix

P: n/a
Dear list,

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.....

function checkEmail() {
var emailVar = document.shorter.email.value;
if (emailVar.length > 0){
if
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.shorter.email
..value))
{
return (true)
}
else
{
alert("Invalid E-mail Address! Please re-enter.")
document.shorter.email.select();
}
}
}
Does anyone know of a similar function that can handle the type of e-mail I
described above with 4 chars? My knowledge of what regexp is doing is a tad
limited to say the least (none - looks gibberish to me but it does work
well!)

Cheers
Iain

Dr Iain Downie
British Trust for Ornithology, The Nunnery, Norfolk IP24 2PU, UK
Tel: +44 (0)1842 750050, fax: +44 (0)1842 750030 Charity No. 216652
Jul 23 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Iain Downie wrote:
Dear list,

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.....

function checkEmail() {
var emailVar = document.shorter.email.value;
if (emailVar.length > 0){
if
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.shorter.email
.value))
{


[snip]

(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/
Allows suffix to be 2 or more characters

(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)
Mick
Jul 23 '05 #2

P: n/a
Thanks, simple really. I had actually tries this, but only tentatively and
my browser must have cached the old version so it kept falling over.

Cheers
Iain

"Mick White" <mw***********@rochester.rr.com> wrote in message
news:8y*********************@twister.nyroc.rr.com. ..
Iain Downie wrote:
Dear list,

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.....

function checkEmail() {
var emailVar = document.shorter.email.value;
if (emailVar.length > 0){
if
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.shorter.email .value))
{


[snip]

(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/
Allows suffix to be 2 or more characters

(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)
Mick

Jul 23 '05 #3

P: n/a
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.
Jul 23 '05 #4

P: n/a
rf
"Iain Downie" <ia*********@bto.org> wrote
Currently, I use a regexp to check on 'normal' emails with 3 chars.....


Less than 5% of the people in the world live in a country that has email
addresses ending with three characters.

The rest of us have email addresses that end in things like .au (Australia),
..uk (the United Kingdom) etc.

Am I not allowed to subscribe to your newsletter just because I live in
Australia?

That .coop you mention means IIRC co-operative. .info is also a valid TLD
these days.

--
Cheers
Richard.
Jul 23 '05 #5

P: n/a
On Tue, 11 Jan 2005 23:31:55 GMT, rf <rf@.invalid> wrote:

[snip]
That .coop you mention means IIRC co-operative. .info is also a valid
TLD these days.


So is museum. See <URL:http://www.iana.org/gtld/gtld.htm>.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #6

P: n/a
"rf" <rf@.invalid> wrote in message
news:Ll*******************@news-server.bigpond.net.au...
"Iain Downie" <ia*********@bto.org> wrote
Currently, I use a regexp to check on 'normal' emails with 3
chars.....
Less than 5% of the people in the world live in a country that has email addresses ending with three characters.

The rest of us have email addresses that end in things like .au (Australia), .uk (the United Kingdom) etc.

Am I not allowed to subscribe to your newsletter just because I live in Australia?


The original poster doesn't know what that regex does, by their own
admission.

It actually checks TLDs that are two or three letters:

/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

Note: {2,3}

Suggested reading on the follies of validating E-mail addresses using a
regular expression: <url:
http://weblogs.asp.net/larryosterman...10/350135.aspx />.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7

P: n/a
JRS: In article <8y*********************@twister.nyroc.rr.com>, dated
Tue, 11 Jan 2005 15:47:16, seen in news:comp.lang.javascript, Mick White
<mw***********@rochester.rr.com> posted :

(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)


Rejects a$**@bbb.cc which is a valid form of address.

--
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.
Jul 23 '05 #8

P: n/a
JRS: In article <Ll*******************@news-server.bigpond.net.au>,
dated Tue, 11 Jan 2005 23:31:55, seen in news:comp.lang.javascript, rf
<rf@?.invalid> posted :
"Iain Downie" <ia*********@bto.org> wrote
Currently, I use a regexp to check on 'normal' emails with 3 chars.....


Less than 5% of the people in the world live in a country that has email
addresses ending with three characters.


His RegExp clearly allowed two or three; and he was looking to change
that part anyway.

By the way, which country are you thinking of? The USA has a proper
two-letter abbreviation, .us matching .uk & .au; and .com and .net are
in practice used world-wide.

--
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.
Jul 23 '05 #9

P: n/a
Dr John Stockton wrote:
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)

Rejects a$**@bbb.cc which is a valid form of address.


Who cares? Only trouble-makers generally use such obscure email addresses
anyway.

--
Matt Kruse
http://www.JavascriptToolbox.com
Jul 23 '05 #10

P: n/a
On Thu, 13 Jan 2005 13:17:36 -0600, "Matt Kruse"
<ne********@mattkruse.com> wrote:
Dr John Stockton wrote:
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)

Rejects a$**@bbb.cc which is a valid form of address.


Who cares? Only trouble-makers generally use such obscure email addresses
anyway.


Lots of businesses have a lot of money from me due to not accepting
+'s in their email addresses. I may be a troublemaker, but I'm one
who spends a lot of cash online.

With GMail encouraging the + format I'm sure more people will be doing
it too.

Jim.
Jul 23 '05 #11

P: n/a
JRS: In article <cs********@news3.newsguy.com>, dated Thu, 13 Jan 2005
13:17:36, seen in news:comp.lang.javascript, Matt Kruse
<ne********@mattkruse.com> posted :
Dr John Stockton wrote:
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)

Rejects a$**@bbb.cc which is a valid form of address.


Who cares? Only trouble-makers generally use such obscure email addresses
anyway.


You are touchingly naive, and have a very limited understanding of
Internet operations. Fortunately, the evil-minded also seem to have a
limited understanding - most of them seem to be aiming at a matching
market - and the better-informed legitimate users can take advantage of
that.

Unless one is specifically aiming to restrict the addresses that one's
customers are allowed to use, one should be sure to accept all forms of
addresses permitted by the RFCs.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Jul 23 '05 #12

P: n/a
"Matt Kruse" <ne********@mattkruse.com> wrote:
Dr John Stockton wrote:
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive) Rejects a$**@bbb.cc which is a valid form of address.

Who cares? Only trouble-makers generally use such obscure email
addresses anyway.


Witness my address. I use a suffix for sorting purposes. With an own
domain like you have, you can have as much boxes as you like, but I am
restricted to this form.

Sometimes I am called a trouble-maker though. But this generally is by
people who don't like being disturbed by facts.
Jul 23 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.