Okay... For all you smarty pants out there who think it's not quite right,
here is an updated version WITH all tld's in it:

function isValidEmail(emailstr) {
        regex_tldList =
".ac|.ad|.ae|.af|.ag|.ai|.al|.am|.an|.ao|.aq|.ar|.ar|.as|.at|.au|.aw|.az|.ba
|.bb|.bd|.be|.bf|.bg|.bh|.bi|.biz|.bj|.bm|.bn|.bo|.br|.bs|.bt|.bv|.bw|.by|.b
z|.ca|.cc|.cd|.cf|.cg|.ch|.ci|.ck|.cl|.cm|.cn|.co|.coop|.com|.cr|.cu|.cv|.cy
|.cx|.cz|.de|.dj|.dm|.do|.dk|.dz|.ec|.edu|.ee|.eg|.eh|.er|.es|.et|.eu|.fi|.f
k|.fm|.fo|.fr|.fx|.ga|.gd|.ge|.gf|.gg|.gh|.gi|.gl|.gm|.gn|.gov|.gp|.gq|.gr|.
gs|.gt|.gu|.gy|.gw|.hm|.hn|.hk|.hr|.ht|.hu|.id|.ie|.il|.im|.in|.info|.int|.i
o|.iq|.ir|.is|.it|.je|.jm|.jo|.jp|.ke|.kg|.ki|.kid|.km|.kn|.kp|.kr|.ky|.kw|.
kz|.la|.lb|.lc|.li|.lk|.lr|.ls|.lt|.lu|.lv|.ly|.ma|.mc|.md|.mh|.mg|.mil|.mk|
.ml|.mm|.mn|.mo|.mp|.mq|.mr|.ms|.mt|.mu|.museum|.mv|.mw|.mx|.my|.mz|.na|.nam
e|.nc|.ne|.net|.nf|.ng|.ni|.nl|.no|.np|.nr|.nu|.nz|.om|.org|.pa|.pe|.pf|.pg|
.ph|.pk|.pl|.pm|.pn|.pr|.pro|.pt|.pw|.py|.qa|.re|.ro|.ru|.rw|.sa|.sb|.sc|.sd
|.se|.sg|.sh|.si|.sj|.sk|.sl|.sm|.sn|.so|.sr|.st|.su|.sv|.sy|.sz|.tc|.td|.tf
|.tg|.th|.tj|.tk|.tm|.tn|.to|.tp|.tr|.tt|.tv|.tw|.ua|.ug|.us|.uk|.um|.uy|.uz
|.va|.vc|.ve|.vg|.vi|.vn|.vu|.wf|.ws|.ye|.yt|.yu|.za|.zm|.zw|.ad|.ae|.al|.am
|.at|.az|.ba|.be|.bf|.bg|.bh|.bj|.by|.cf|.ch|.ci|.cm|.cv|.cy|.cz|.de|.dj|.dk
|.dz|.ee|.eg|.er|.es|.eu|.fi|.fo|.fr|.ga|.gb|.ge|.gg|.gh|.gi|.gn|.gq|.gr|.gw
|.hr|.hu|.ie|.il|.im|.io|.iq|.ir|.is|.it|.je|.jo|.ke|.kg|.kz|.lb|.li|.lr|.lu
|.lv|.ma|.mc|.md|.mk|.ml|.mt|.ne|.ng|.nl|.no|.om|.pl|.pt|.qa|.ro|.ru|.sa|.se
|.si|.sj|.sk|.sl|.sm|.sn|.su|.sy|.td|.tj|.tm|.tn|.tr|.ua|.ug|.uk|.uz|.va|.ye
|.yu";
        regex_tldlist = replace(regex_tldlist, ".", "", "all");
        regex_tld =
"^[a-zA-Z0-9!##\$%&''\*\+-/=\?\^_`\{\|}~]+([.][a-zA-Z0-9!##\$%&''\*\+-/=\?\^
_`\{\|}~]+)*@([a-z0-9]([-]|[a-z0-9])*[a-z0-9][.])+(#regex_tldlist#)$";
        if(REFind(regex_tld, emailstr)) {
                return true;
        }
        else
                return false;
}
</cfscript>

Or download it from here:
http://www.pjnetsolutions.com/regex/isValidEmail.func

Watch the word wrap!

Paul

PS The reason it validates [EMAIL PROTECTED] is that the domain spec does not
account for tlds and only gives a specification for naming!  Foo.foo is a
valid domain name, it's just that it's not a valid tld!
-------------------------------------------
Paul Johnston
PJ Net Solutions Ltd
http://www.pjnetsolutions.com
[EMAIL PROTECTED]
+44 (0)7866 573013




--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to