carlosasin
8/21/2013 - 7:49 AM

JS - Check correct Mail using pattern

JS - Check correct Mail using pattern

// Check if mail is correct (leters @ leters . leters(2-4))
// @input str string to check
// @return bool
function check_mail(str) {
	var ml = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (str != undefined && str.match(ml)) return true;
	else return false;
}