Return to Snippet

Revision: 26502
at April 29, 2010 10:21 by adrianparr


Initial Code
var inputEmail:String = "[email protected]";
trace("inputEmail: "+inputEmail);
trace("isValidEmailAddress: "+isValidEmailAddress(inputEmail));

function isValidEmailAddress($str:String):Boolean {
	return (($str == findValidEmailAddress($str)) ? true : false);
}

function findValidEmailAddress($str:String):String {
	var pattern:RegExp = /\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b/gi;
	var result:Object = pattern.exec($str);
	return ((result == null) ? "" : result[0]);
}

Initial URL

                                

Initial Description

                                

Initial Title
AS3 Checks a String to see if it is a Valid Email Format

Initial Tags
regex, email, format, regexp

Initial Language
ActionScript 3