Check Email Format

2011年3月26日 星期六 by Hu, Ching-Hsiang


function isValidEmailAddress($str:String):Boolean {
return (($str == findValidEmailAddress($str)) ? true : false);
}

function findValidEmailAddress($str:String):String {
var pattern:RegExp = /\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b/gi;
var result:Object = pattern.exec($str);
return ((result == null) ? "" : result[0]);
}

Filed under having  

0 意見: