473,327 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

emails with 4 chars in suffix

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
12 2108
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
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
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
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
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
"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
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
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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: p.kosina | last post by:
Its just for my convienience: When saving new file in IDLE I HAVE to always manually add suffix .py, otherwise it is saved without ANY suffix. Can it be set somewhere? Thank you Pavel
3
by: danpres2k | last post by:
Hello, I have a file with email address at a lot of junk data. I want to get the email addresses out of that file so that each email address is stored at a new line. I am trying to do...
3
by: Green | last post by:
Hi, I have a question that when i surf the internet, i found out that using ..aspx suffix means using asp.net, using .jsp means using javaserver page, etc. But some don't have any suffix. For...
5
by: Kun | last post by:
i have the following code: ---------------------------------- import smtplib from email.MIMEText import MIMEText fp = open('confirmation.txt', 'rb') msg = MIMEText(fp.read()) From =...
9
by: Hamish M | last post by:
Hi I am interested in opinions on this topic. I have heard that a suffix is not a good solution and type casts are much better for example. ...
4
by: John | last post by:
Hi I have this problem that client users enter emails incorrectly due to type and either the domain name is invalid (Microsot.com instead of Microsoft.com) or the syntax of the email...
4
by: Denis Jevon | last post by:
I have a problem which is probably simple to solve but I can't find the answer. In the past I have added pages to sites I have built with names like aboutus.html and when I or anyone else wants to...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
6
by: Christoph Zwerschke | last post by:
In Python programs, you will quite frequently find code like the following for removing a certain prefix from a string: if url.startswith('http://'): url = url Similarly for stripping...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.