Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19253
| From | Stefan Weiss <krewecherl@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Restrict a domain on Email Validation |
| Date | 2013-04-13 11:36 +0200 |
| Organization | albasani.net |
| Message-ID | <kkb8ui$i3i$1@news.albasani.net> (permalink) |
| References | (5 earlier) <3115834.VOAWd18DUa@PointedEars.de> <kk79oi$f7q$1@news.albasani.net> <1934436.yJr0pKV1Qq@PointedEars.de> <kk7d5p$lfj$1@news.albasani.net> <4132599.O2IUq2hl1o@PointedEars.de> |
On 2013-04-12 00:42, Thomas 'PointedEars' Lahn wrote:
> Stefan Weiss wrote:
>> On 2013-04-11 23:31, Thomas 'PointedEars' Lahn wrote:
>>> Stefan Weiss wrote:
>>>> | block all email addresses from @forbidden.*
>>>> | (Where * can be org, com. co.uk, se ...... etc)
>>>>
>>>> forbidden.planet.example.com is clearly a false positive.
>>>
>>> Your logic is flawed. “...... etc” makes it clear that *any* domain name
>>> whose bottom level is named “forbidden” is to be rejected, including
>>> forbidden.planet.example.com.
>>
>> That's a *very* generous interpretation of "etc".
>
> You must be kidding. That (anything of the same sort) is the very meaning
> of ”etc.” – et cetera – and so on. I do not think the program (or problem)
> specification could be more clear in that respect: “*” is used as a
> placeholder here; it is defined by examples afterwards, where the list of
> examples is _not_ exhaustive, due to “etc.” Much like saying “Even numbers,
> like 2, 4, 6, etc.” by definition includes 42.
Unless the OP returns to clarify what he meant, we'll never find out.
You chose to go letter-of-the-law and interpret "etc" as "anything
goes", which reduces the problem to a trivial check. I chose to read
between the lines and interpret "etc" as top-level domain plus possibly
a reserved second-level domain suffix (as in the case of "co.uk"). That
problem is a lot harder to solve.
What makes more sense to you, that somebody doesn't want email addresses
for company.de, company.co.uk, company.com.tr, or maybe even
affiliates.company.de entered in their forms, or that they don't want
the word "company" to appear as the first word of the mail domain part
for some reason?
>> If that's indeed how you read it, the whole problem becomes trivial.
>> In that case, I wonder why you would prefer a regular expression to
>> indexOf().
>
> Because – again – indexOf() is _not_ equivalent.
You keep saying that, but have yet to provide any explanation. And no,
"your logic is flawed" is not an explanation. See below.
>>>> To be clear, for the purpose of testing if the domain name
>>>> part "forbidden" follows the @-sign,
>>>>
>>>> if (!(/original-regex/.test(str) && !/your-regex/.test(str)))
>>>>
>>>> is equivalent to
>>>>
>>>> if (!(/original-regex/.test(str) && str.indexOf("@forbidden.") < 0))
>>>>
>>>> or, with the negated parenthesized expression resolved,
>>>>
>>>> if (!/original-regex/.test(str) || str.indexOf("@forbidden.") > -1)
>>>
>>> No, it is not. Your logic is flawed.
>>
>> Saying "no" and "your logic is flawed" means nothing (especially coming
>> from you). If you find anything to disprove the statement, let me know;
>> until then I'll just consider you too stubborn to admit a mistake.
>
> No, this is not how a proper discussion works. You are to prove your
> argument first. You will see then that you are wrong.
Prove my argument? What do you expect me to do, formally prove the
correctness of code? That's a notoriously difficult and time consuming
problem, and hardly necessary here. You can read JavaScript code, and I
would have expected you to understand what it does. But for the record:
while the OP's original regex is not a good test for valid email
addresses, it ensures that there can only be a single @-sign in the
string, that it is surrounded by at least one word character on either
side, and that only [\w@.-] can appear in the string. Given that, a
substring search for "@forbidden." is all that is required to check
whether the first part of the address domain part is "forbidden". Using
a regex will not improve that test. That's what I said and that's what
you're contradicting. I may be wrong, but now it's up to you to explain why.
The equivalence I claimed cannot be proven with a finite number of
examples, but it only takes a single counter example to falsify it.
Since you're so certain that they are not equivalent, it should be easy
enough for you to provide such an example (not that I expect you to).
As for "proper discussions"... past experience has shown that any
attempt at having a proper discussion with you is an exercise in
futility. In contrast to you, the time I'm willing to spend in this
group is limited; if you prefer to mince words and demand impossible
proofs instead of discussing code, don't expect a reply.
- stefan
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Restrict a domain on Email Validation GarryJones <morack@algonet.se> - 2013-04-11 10:33 -0700
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 20:40 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-11 20:53 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 21:09 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 21:35 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-11 21:49 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 22:04 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-11 23:25 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-11 23:31 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-12 00:23 +0200
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-12 00:42 +0200
Re: Restrict a domain on Email Validation Stefan Weiss <krewecherl@gmail.com> - 2013-04-13 11:36 +0200
Re: Restrict a domain on Email Validation Scott Sauyet <scott.sauyet@gmail.com> - 2013-04-20 13:30 -0700
Re: Restrict a domain on Email Validation Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-12 00:51 +0200
Re: Restrict a domain on Email Validation Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-04-12 19:36 +0100
Re: Restrict a domain on Email Validation "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-04-13 10:40 +0200
csiph-web