Cheers Paul!

-----Original Message-----
From: Paul Johnston [mailto:[EMAIL PROTECTED]
Sent: 27 February 2003 15:29
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] email verification


Here it is:

-------------code-------------

<cfscript>
// Copyright (c)2003 PJ Net SOlutions Ltd
// all rights reserved
// isValidEmail function version 1.1
// http://www.pjnetsolutions.com/regex/
// You are free to use this code subject to these conditions:
// If you use this code, you must include these comments to show that
// the code has been take from the PJ Net Solutions Ltd website.

// Function returns true or false depending on whether or not it's valid
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|.uz|.va|.ye|.yu
|.co.uk|.com.uk|.ltd.uk";
        regex_tldlist = REreplace(regex_tldlist, "([^a-zA-Z])[.]", "\1",
"all");
        regex_tldlist = Right(regex_tldlist, len(regex_tldlist) - 1);
        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>

-------------code-------------

Please play with it all you like.  It's done as a function so that you can
use it on your site anywhere.  I also have a cfc that I'm working on (that I
will post when it works) that will also check the MX record and check that
the email can be sent to the user to validate it.

Paul

-------------------------------------------
Paul Johnston
PJ Net Solutions Ltd
http://www.pjnetsolutions.com
[EMAIL PROTECTED]
+44 (0)7866 573013


> -----Original Message-----
> From: Douglas McKenzie [mailto:[EMAIL PROTECTED]
> Sent: 27 February 2003 15:22
> To: CF-Dev
> Subject: [ cf-dev ] email verification
>
>
> I remember some chat about an email verification regex that
> someone was working on not too long ago. Was wondering if it
> could be reposted so I can have a play with it?
>
> Cheers,
> Douglas McKenzie
>
> ----------------------------------------
> Internet Developer / Designer
> [EMAIL PROTECTED]
> 020 7267 6718
> ----------------------------------------
>
>
> --
> ** 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]
>



--
** 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]



-- 
** 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