Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <1934436.yJr0pKV1Qq@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 11 Apr 2013 23:31:11 +0200 User-Agent: KNode/4.8.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <7867864.kBbL0iy7tU@PointedEars.de> <2615387.eNcf81pqbo@PointedEars.de> <3115834.VOAWd18DUa@PointedEars.de> MIME-Version: 1.0 Lines: 69 NNTP-Posting-Date: 11 Apr 2013 23:31:12 CEST NNTP-Posting-Host: bf2e18a3.newsspool3.arcor-online.net X-Trace: DXC=B`IU[dVF\O=^8FBo0_81f>McF=Q^Z^V384Fo<]lROoR18kF 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. 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. >>> 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) No, it is not. Your logic is flawed. > The point is that none of these really solve the OP's problem > (but they might be sufficient for his purposes, anyway). The expression that I posted does solve the OP's problem; you have just misunderstood the problem. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.