Home     Publications     Articles and Projects     PhD Thesis     Links    


Email Validation in Javascript

Here is a validation function for email addresses in Javascript. You can probably see that the regular expression means this:

Something alphanumeric or valid symbols, then @, then something alphanumeric or valid symbols including dots ( a sequence of subdomain names ), then a dot and a short alphabetic sequence for the top level domain ( .com .ie etc. ).

function validate_email_address(email_address) {

	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;  
	return emailPattern.test(email_address); 

}