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


Groups > comp.lang.javascript > #19232

Re: Restrict a domain on Email Validation

Message-ID <2615387.eNcf81pqbo@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-04-11 21:09 +0200
Subject Re: Restrict a domain on Email Validation
Newsgroups comp.lang.javascript
References <9e42c475-f0f4-4822-98d4-0291745f3447@googlegroups.com> <7867864.kBbL0iy7tU@PointedEars.de> <kk70s5$rdc$1@news.albasani.net>

Show all headers | View raw


Stefan Weiss wrote:

> On 2013-04-11 20:40, Thomas 'PointedEars' Lahn wrote:
>> GarryJones wrote:
>>> How can I change the script to block all email addresses from
>>> @forbidden.*
>> 
>>   …
>>   && !/@forbidden\.[^.]+$/.test(…)
> ...
>>> (Where * can be org, com. co.uk, se ...... etc)
> 
> That pattern won't match "@forbidden.co.uk".

Correct.  Use

  …
  && !/@forbidden(\.[^.]+)+$/.test(…)

or 

  …
  && !/@forbidden(\..+?)+$/.test(…)

then (the former is backwards-compatible and presumably more efficient than 
the latter).  You may also want to insert “\s*” before “$” to account for 
trailing whitespace.  The RegExp constructor comes in handy here with regard 
to an easily maintained list of allowed characters (which reminds me to look 
into pattern interpolation for jsx.regexp.RegExp).

In any case, the expression appropriate for this task can be derived from 
RFC 5322, section 3.4.1.  (I have pos[i]ted the approach before, but I do 
not know the Message-ID.)

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

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