Validate Email Address with RegExp


/ Published in: ActionScript 3
Save to your folder(s)

From the tutorial, Validating Various Input Data in Flash (http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/)


Copy this code and paste it in your HTML
  1. public function checkEmailAddress(emailAddress:String):Boolean
  2. {
  3. var address:String = "([a-z0-9._-]+)";
  4. var domainName:String = "([a-z0-9.-]+)";
  5. var domainExt:String = "([a-z]{2,6})";
  6.  
  7. var email:RegExp = new RegExp("^" + address + "@" + domainName + "\\." + domainExt + "$", "i");
  8.  
  9. return email.test(emailAddress);
  10. }

URL: http://active.tutsplus.com/tutorials/actionscript/validating-various-input-data-in-flash/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.