473,383 Members | 1,868 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,383 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 2111
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...
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...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.