Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19236

Re: Restrict a domain on Email Validation

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Restrict a domain on Email Validation
Date 2013-04-11 23:25 +0200
Organization albasani.net
Message-ID <kk79oi$f7q$1@news.albasani.net> (permalink)
References (1 earlier) <7867864.kBbL0iy7tU@PointedEars.de> <kk70s5$rdc$1@news.albasani.net> <2615387.eNcf81pqbo@PointedEars.de> <kk743r$2vr$1@news.albasani.net> <3115834.VOAWd18DUa@PointedEars.de>

Show all headers | View raw


On 2013-04-11 22:04, Thomas 'PointedEars' Lahn wrote:
> Stefan Weiss wrote:
>> On 2013-04-11 21:09, Thomas 'PointedEars' Lahn wrote:
>>> Stefan Weiss wrote:
>>>> On 2013-04-11 20:40, Thomas 'PointedEars' Lahn wrote:
>>>>> 
>>>>>   && !/@forbidden\.[^.]+$/.test(…)
>> ...
>>>> That pattern won't match "@forbidden.co.uk".
>>> 
>>> Correct.  Use
>>> 
>>>   …
>>>   && !/@forbidden(\.[^.]+)+$/.test(…)
>>> 
>>> or
>>> 
>>>   …
>>>   && !/@forbidden(\..+?)+$/.test(…)
>> 
>> Okay, but that also matches "@forbidden.planet.example.com".
> 
> So?

So it doesn't solve the problem as stated:

| block all email addresses from @forbidden.*
| (Where * can be org, com. co.uk, se ...... etc)

forbidden.planet.example.com is clearly a false positive.

>> In conjunction with the OP's original regex, looking for the substring
>> "@forbidden." would do the same thing.
> 
> No, (!x && !y) is logically equivalent to !(x || y).

You're contradicting an imaginary statement - I never even mentioned any
operators. 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)


The point is that none of these really solve the OP's problem
(but they might be sufficient for his purposes, anyway).


- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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