Email Validator


function isValidEmail(email){
	
	// Simple validator
	var filter = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/
	
	// Advanced validator
	// var filter = /^([0-9a-zA-Z-!\'%&\*\+\/=\?^`{}\|$~]([-.!\'%&\*\+\/=\?^`{}\|$~\w]*[0-9a-zA-Z\-!\'%&\*\+\/=\?^`{}\|$~])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[a-zA-Z]{2,9})$/

	return filter.test(email);
}
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...