Validation Phone and Email with Action Script 3

1:07 pm Uncategorized

Email Validation:

function validateEmail(email:String):Boolean {
var emailExpression:RegExp = /^[a-z][w.-]+@w[w.-]+.[w.-]*[a-z][a-z]$/i;
return ! emailExpression.test(email);
}

Phone Validation:

function validatePhone(phone:String):Boolean {
var emailExpression:RegExp = /^((+d{1,3}(-| )’('d)’(-| )’d{1,3})|((’d{2,3})’))(-| )’(d{3,4})(-| )’(d{4})(( x| ext)d{1,5}){0,1}$/i;
return ! emailExpression.test(phone);
}

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.