Tech Rocks

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more... contact@tech-rocks.org

Sunday, April 10, 2011

Email RegExp

Example:

function checkEmail(str)
{
    var x = str;
    var filter = /^(['a-zA-Z0-9_\.\-\\])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (filter.test(x)) return true;
    return false;
}

1 comments :

Unknown said...

Not that there's anything wrong with your UDF but wanted to throw out a reminder that, in CFML, you can also use isValid :)!

isValid("email","myemailaddress@email.com");