/ Published in: ActionScript 3
The source below is the function from the website with the corrected regular expression found in the site's comments. This is a nigh-one-line function for validating a string as an email address.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
*/ syntax: if (!isValidEmail("my_NON_email.com")) { trace("FAIL"); } */ private function isValidEmail(email:String):Boolean { var emailExpression:RegExp = /([a-z0-9._-]+?)@([a-z0-9.-]+)\.([a-z]{2,4})/; return emailExpression.test(email); }
URL: http://www.lukegill.com/blog/as3-email-validation/