Posted By

Activetuts on 01/13/11


Tagged


Versions (?)

Who likes this?

24 people have marked this snippet as a favorite

kojok
chus
gandreini
elbjoern
toxin20
alsodenn
leadingmannigel
ichnoweb
thanksmister
kure69
AndrewPotter
hejaaa
JaaQ
im3der
souellette
elderhsouza
merritt212
frcomarin
unibox
MartinM79
timr
coutlasssupreme
burnandbass
flashdeveloper


Email Validation


 / Published in: ActionScript 3
 

URL: http://enva.to/e4ig6z

When accepting input from a user through a form it is often necessary to validate data before allowing it to be sent to a back-end script. This is most true for email addresses as they are often the only point of contact between yourself and the user and are important to get right. The below function makes use of a regular expression to confirm the email is of a valid format.

  1. function isValidEmail(email:String):Boolean
  2. {
  3. var emailExpression:RegExp = /([a-z0-9._-]+?)@([a-z0-9.-]+)\.([a-z]{2,4})/i;
  4. return emailExpression.test(email);
  5. }

Report this snippet  

You need to login to post a comment.