Email Validation in ActionScript 3.0 using RegExp

You can use following function for validation of email using ActionScript 3.0 RegExp class.

/**
* @usage    Check if the given email address string is valid or not
* @param    email:String    Email address string that is to be checked
* @return    Boolean        Returns true if valid email, false otherwise
*/
public function isValidEmail(email:String):Boolean
{
var emailExpression:RegExp = /^[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$/i;
return emailExpression.test(email);
}

Hope it would be useful to someone 🙂

Regards,

Naresh Khokhaneshiya