Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18227 > unrolled thread
| Started by | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| First post | 2013-01-23 15:27 -0700 |
| Last post | 2013-01-26 20:51 +0000 |
| Articles | 9 on this page of 29 — 11 participants |
Back to article view | Back to comp.lang.javascript
Email Vali8dation Problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-23 15:27 -0700
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-24 01:18 +0100
Re: Email Vali8dation Problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-24 02:06 +0100
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-24 22:30 +0100
Re: Email Vali8dation Problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-24 22:38 +0100
Re: Email Vali8dation Problem Jeff North <jnorthau@yahoo.com.au> - 2013-01-24 13:04 +1100
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-24 22:24 +0100
Re: Email Vali8dation Problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-24 22:40 +0100
Re: Email Vali8dation Problem Jeff North <jnorthau@yahoo.com.au> - 2013-01-26 00:12 +1100
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-25 21:56 +0100
Re: Email Vali8dation Problem Jeff North <jnorthau@yahoo.com.au> - 2013-01-26 10:56 +1100
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-26 01:56 +0100
Re: Email Vali8dation Problem Jeff North <jnorthau@yahoo.com.au> - 2013-01-26 20:14 +1100
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-26 13:21 +0100
Re: Email Vali8dation Problem Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2013-01-26 15:07 +0200
Re: Email Vali8dation Problem "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-01-26 16:04 +0200
Re: Email Vali8dation Problem Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2013-01-26 16:37 +0200
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-26 15:46 +0100
Re: Email Vali8dation Problem Jeff North <jnorthau@yahoo.com.au> - 2013-01-27 10:30 +1100
Re: Email Vali8dation Problem Andreas Bergmaier <andber93@web.de> - 2013-01-24 01:58 +0100
Re: Email Vali8dation Problem Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-01-24 02:08 +0100
Re: Email Vali8dation Problem "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-01-24 10:25 +0100
Re: Email Vali8dation Problem Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-01-24 11:15 +0100
Re: Email Validation Problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-24 08:53 -0700
Re: Email Validation Problem Luc Yen <luc@goal.tw> - 2013-01-25 13:53 -0800
Re: Email Vali8dation Problem Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-01-24 19:59 +0000
Re: Email Vali8dation Problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-01-25 09:37 -0700
Re: Email Vali8dation Problem Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-01-25 22:08 +0100
Re: Email Vali8dation Problem Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-01-26 20:51 +0000
Page 2 of 2 — ← Prev page 1 [2]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-01-24 02:08 +0100 |
| Message-ID | <4240890.sJdzFZ7Tup@PointedEars.de> |
| In reply to | #18231 |
Andreas Bergmaier wrote: > Mel Smith schrieb: >> google brings up dozens of variations for this task, but I'd like >> to get the 'perfect' one :(( > > There is no perfect one. There are perfectly reasonable ones, though. > Email adresses in RFC format are even not parsable by regular expressions. Utter nonsense. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2013-01-24 10:25 +0100 |
| Message-ID | <XnsA1526A14F8FDBeejj99@194.109.133.133> |
| In reply to | #18231 |
Andreas Bergmaier wrote on 24 jan 2013 in comp.lang.javascript:
>> google brings up dozens of variations for this task, but I'd like
>> to get the 'perfect' one :((
>
> There is no perfect one. Email adresses in RFC format are even not
> parsable by regular expressions.
The only perfect validation is sending a test email,
and receiving a confirmation.
Even then it could be the wrong destination.
=================================
Usually the requirement could be simplified to answer these questions:
1 Is the field not left empty, or filled by whitespace only?
2 Is the field not filled by a response to another field,
like a name or postcode?
3 Is only a single emailadress entered?
These are reasonably answered by just:
var emailCorrect = /@[^@]+$/.test(emailField.value)
=======================
For the more ambitious perhaps:
var emailCorrect = /^\s*\S+@[^@\s]{3,}\s*$/.test(emailField.value)
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Cezary Tomczyk <cezary.tomczyk@gmail.com> |
|---|---|
| Date | 2013-01-24 11:15 +0100 |
| Message-ID | <kdr1j6$9gu$1@speranza.aioe.org> |
| In reply to | #18227 |
W dniu 2013-01-23 23:27, Mel Smith pisze:
[...]
> m.smith@dumbo.example.com also, obviously returns 'false'.
>
> Woud someone take a 'stab' at correcting the regex expression below to
> allow the above formatted email addresses to return 'true'.
[...]
I am using this pattern for checking if e-mail address is valid:
/\b\w+([\-._]\w+)*@[a-zA-Z_]\w+(\.[a-zA-Z_]\w+)*\.[a-zA-Z]{2,6}/gi
Probably could be improved in a many ways.
--
Cezary Tomczyk
http://www.ctomczyk.pl/
[toc] | [prev] | [next] | [standalone]
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2013-01-24 08:53 -0700 |
| Subject | Re: Email Validation Problem |
| Message-ID | <amd3neF83mU1@mid.individual.net> |
| In reply to | #18239 |
To all responders:
I'll examine and work on your suggestions and test them and see if they
can handle the cases I've noted and those other cases where 'true' was
returned -- but should not have been.
I'm wondering if there is a possibility of a common (for our JavaScript
ng) regex solution for email validation, that we can all use for our work ?
I've also heard mentioned of a function called (I believe) checkdnsrr()
which is used by server software to do more thorough checks of a suspect
email address. Is this 'function' available as a download or C source that
can be compiled (I have several C compilers on my machine).
Thank to y'all.
-Mel Smith
[toc] | [prev] | [next] | [standalone]
| From | Luc Yen <luc@goal.tw> |
|---|---|
| Date | 2013-01-25 13:53 -0800 |
| Subject | Re: Email Validation Problem |
| Message-ID | <583146fb-feda-477e-8bc7-d710ab6a5744@googlegroups.com> |
| In reply to | #18241 |
Mel Smith於 2013年1月24日星期四UTC+8下午11時53分06秒寫道: > To all responders: > > > > I'll examine and work on your suggestions and test them and see if they > > can handle the cases I've noted and those other cases where 'true' was > > returned -- but should not have been. > > > > I'm wondering if there is a possibility of a common (for our JavaScript > > ng) regex solution for email validation, that we can all use for our work ? > > > > I've also heard mentioned of a function called (I believe) checkdnsrr() > > which is used by server software to do more thorough checks of a suspect > > email address. Is this 'function' available as a download or C source that > > can be compiled (I have several C compilers on my machine). > > > > Thank to y'all. > > > > -Mel Smith No general rule. Client side script is used for checking well-formedness and minimizing round-trip to server. Validation is another issue. Sometimes you need to add [\uxxxx-\uxxxx] character class or add plenty of TLDs to cover your user space. Keep it simple, don't block your user, and do something better than just checking '@' and '.'
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> |
|---|---|
| Date | 2013-01-24 19:59 +0000 |
| Message-ID | <JqhEReJ0KZARFws0@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #18227 |
In comp.lang.javascript message <amb6f9Fhvk3U1@mid.individual.net>, Wed,
23 Jan 2013 15:27:43, Mel Smith <med_cutout_syntel@aol.com> posted:
>
> I have the following undernoted isEMail() function defined in the <head>
>section of a page
>
There is little point in trying to validate the format of an E-address
(except for those writing E-mail software) when there is no possibility
of writing code that will report
reply1300@merlyn.demon.co.uk as good and
reply1300@merlyn.denom.co.uk as probably no good
Of those, the first should, IIRC, apparently be delivered, but will
bounce after 30 days (unless in the meanwhile I change what that address
does), while the second is to an address which (at this instant) does
not exist.
Also, if you "validate" against what you apparently think the format
should be, you will reject valid (admittedly uncommon) types of address
[e.g. designed to work, but not to be believed by address harvesters].
Before attempting a validator, you should find, read, and understand the
latest applicable RFC for E-addresses.
It should be useful, though, to check that the string provided might
possibly an E-address - users sometimes may get their field order wrong
and insert their snail-mail address or telephone number instead.
A valid address will contain at least one character, followed by @,
followed by at least one character, followed by a dot, and ending with
at least two alphabetic characters (though the RFC itself may be more
(or less) lenient) - and it will not end in ".invalid" or, IIRC & in
practice, "example.com".
In any case, the name of your function should be changed to maybeEmail
or suchlike.
For my more considered but older thoughts, look in
<http://www.merlyn.demon.co.uk/js-valid.htm>.
--
(c) John Stockton, Surrey, UK. ¬@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
[toc] | [prev] | [next] | [standalone]
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2013-01-25 09:37 -0700 |
| Message-ID | <amfqn3Fj7guU1@mid.individual.net> |
| In reply to | #18246 |
Dr JR said > There is little point in trying to validate the format of an E-address > (except for those writing E-mail software) when there is no possibility > of writing code that will report > reply1300@merlyn.demon.co.uk as good and > reply1300@merlyn.denom.co.uk as probably no good > > Of those, the first should, IIRC, apparently be delivered, but will > bounce after 30 days (unless in the meanwhile I change what that address > does), while the second is to an address which (at this instant) does > not exist. > > Also, if you "validate" against what you apparently think the format > should be, you will reject valid (admittedly uncommon) types of address > [e.g. designed to work, but not to be believed by address harvesters]. > Before attempting a validator, you should find, read, and understand the > latest applicable RFC for E-addresses. > > It should be useful, though, to check that the string provided might > possibly an E-address - users sometimes may get their field order wrong > and insert their snail-mail address or telephone number instead. > > A valid address will contain at least one character, followed by @, > followed by at least one character, followed by a dot, and ending with > at least two alphabetic characters (though the RFC itself may be more > (or less) lenient) - and it will not end in ".invalid" or, IIRC & in > practice, "example.com". This is discouraging :( -Mel
[toc] | [prev] | [next] | [standalone]
| From | Eric Bednarz <bednarz@fahr-zur-hoelle.org> |
|---|---|
| Date | 2013-01-25 22:08 +0100 |
| Message-ID | <m2ip6lc6ng.fsf@nntp.bednarz.nl> |
| In reply to | #18250 |
"Mel Smith" <med_cutout_syntel@aol.com> writes: > Dr JR said >> A valid address will contain at least one character, followed by @, >> followed by at least one character, followed by a dot, and ending with >> at least two alphabetic characters (though the RFC itself may be more >> (or less) lenient) - and it will not end in ".invalid" or, IIRC & in >> practice, "example.com". > > This is discouraging :( It's also completely made up (but to be fair, the relevant RFCs were probably not written by Britons and as such irrelevant in Stockton's parallel universe).
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> |
|---|---|
| Date | 2013-01-26 20:51 +0000 |
| Message-ID | <zENqaBGDHEBRFwQY@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #18254 |
In comp.lang.javascript message <m2ip6lc6ng.fsf@nntp.bednarz.nl>, Fri, 25 Jan 2013 22:08:35, Eric Bednarz <bednarz@fahr-zur-hoelle.org> posted: >"Mel Smith" <med_cutout_syntel@aol.com> writes: > >> Dr JR said > >>> A valid address will contain at least one character, followed by @, >>> followed by at least one character, followed by a dot, and ending with >>> at least two alphabetic characters (though the RFC itself may be more >>> (or less) lenient) - and it will not end in ".invalid" or, IIRC & in >>> practice, "example.com". >> >> This is discouraging :( That was intentional, because that is what the facts mean. >It's also completely made up (but to be fair, the relevant RFCs were >probably not written by Britons and as such irrelevant in Stockton's >parallel universe). Give me an example, then, of a valid E-address which does not comply with the requirements of the >>> paragraph. Perhaps you have forgotten the difference between "necessary" and "necessary and sufficient", and/or that "A implies B" does not imply "B implies A". The ONLY way to fully validate an E-address is to use it and get an appropriate reply - that even that only validates the address, as far as each machine that checks it is concerned, at the time when that machine actually performed its check. One can check whether the address complies with the relevant RFCs; but there is no general guarantee that the machines which handle the mail item comply exactly with those RFCs - some mail software, for example, is written by Microsoft, and their software failed to comply fully with ISO 8601 - some may be written by Apple, and their JavaScript failed to comply with /Inter gravissimas/ of AD 1581 (I hope that you are familiar with at least some of the consequences of that document). -- (c) John Stockton, nr London UK Reply address via Home Page. news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>. <http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.javascript
csiph-web