Posted By

Winkyboy on 11/03/09


Tagged

form email valid post validation validate as3


Versions (?)

Who likes this?

10 people have marked this snippet as a favorite

heinrichson
forze
quan
iamgowan
Ether
visualadvance
tspitzr
dubogii
kojok
Josueriv


AS3 Email Validation


 / Published in: ActionScript 3
 

URL: http://www.lukegill.com/blog/as3-email-validation/

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.

  1. */ syntax:
  2. if (!isValidEmail("my_NON_email.com")) {
  3. trace("FAIL");
  4. }
  5. */
  6.  
  7. private function isValidEmail(email:String):Boolean {
  8. var emailExpression:RegExp = /([a-z0-9._-]+?)@([a-z0-9.-]+)\.([a-z]{2,4})/;
  9. return emailExpression.test(email);
  10. }

Report this snippet  

You need to login to post a comment.