Validate Email Address

Description: Simple function for checking if an email address is in the proper format.
Tested Platform: PHP 5
Language: PHP
// Validate email address
function validate_email($address) {
	return preg_match('/^[a-z0-9_-][a-z0-9._-]+@([a-z0-9][a-z0-9-]*\.)+[a-z]{2,6}$/i', $address);
}

Submitted: December 11, 2012

Return to the snippets listing