/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
trace("inputEmail: "+inputEmail); trace("isValidEmailAddress: "+isValidEmailAddress(inputEmail)); 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]); }