Posted By

FlashJunior on 08/06/08


Tagged

email validate


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

THEPWN3R


e-Mail check


 / Published in: ActionScript 3
 

Just a small Regular expression..

  1. function checkEmail (mail:String):Boolean {
  2. var regExpPattern : RegExp = /^[0-9a-zA-Z][-._a-zA-Z0-9]*@([0-9a-zA-Z][-._0-9a-zA-Z]*\.)+[a-zA-Z]{2,6}$/;
  3. if( mail.match(regExpPattern) == null ) { return false; } else { return true; }
  4. }
  5.  
  6. trace(checkEmail("martin@@domain.ch")); //false
  7. trace(checkEmail("[email protected]")); //true
  8. trace(checkEmail("martin@domain")); //false
  9. trace(checkEmail("@domain.de"));//false
  10. trace(checkEmail("[email protected]")); //true
  11. trace(checkEmail("martin [email protected]")); //false
  12. trace(checkEmail("[email protected]")); //false
  13. trace(checkEmail("[email protected]")); //true
  14. trace(checkEmail("martin_bommeli@@subdomain.domain.ch")); //false

Report this snippet  

You need to login to post a comment.