If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Regular expressions are something that were introduced in AS3 with a sigh of relief from all flash developers. Yay
Below is a code snippet posted by senocular at kriupa
function isValidEmail(email:String):Boolean { var emailExpression:RegExp = /^[a-z][\w.-]+@\w[\w.-]+\.[\w.-]*[a-z][a-z]$/i;
return emailExpression.test(email);
}
//...
trace(isValidEmail("senocular@example.com")); // true
trace(isValidEmail("@example.com")); // false
trace(isValidEmail("senocular@example")); // false
trace(isValidEmail("seno\\cular@example.com")); // false
Its a beautiful thing.
Found this useful? How about buying me a coffee - simply click here.

