emails with 4 chars in suffix

I

Iain Downie

Dear list,

we are getting a few folk trying to register for our birdwatching surveys
with emails of the form: (e-mail address removed), 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
 
M

Mick White

Iain said:
Dear list,

we are getting a few folk trying to register for our birdwatching surveys
with emails of the form: (e-mail address removed), 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
 
I

Iain Downie

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 said:
Iain said:
Dear list,

we are getting a few folk trying to register for our birdwatching surveys
with emails of the form: (e-mail address removed), 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
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Tue, 11
Jan 2005 15:06:32, seen in Iain Downie
we are getting a few folk trying to register for our birdwatching surveys
with emails of the form: (e-mail address removed), 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" <[email protected]>
or (e-mail address removed) (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>.
 
R

rf

Iain Downie said:
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.
 
D

Dr John Stockton

JRS: In article <[email protected]>,
dated Tue, 11 Jan 2005 23:31:55, seen in rf
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.
 
G

Grant Wagner

rf said:
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/archive/2005/01/10/350135.aspx />.
 
J

Jim Ley

Dr said:
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)
Rejects [email protected] 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.
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Thu, 13 Jan 2005
13:17:36, seen in Matt Kruse
Dr said:
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)
Rejects [email protected] 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.
 
M

Martin Bialasinski

Matt Kruse said:
Dr said:
(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/
Allows suffix to be between 2 and 6 characters (inclusive)
Rejects [email protected] 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top