Jump to content

[SOLVED] Checking valid e-mails using regex?


Wolphie

Recommended Posts

Here's a builtin way:

if (filter_var($email, FILTER_VALIDATE_EMAIL))	//	builtin php func!

and here's a regex way I use (it may need ammendment still, but it also catches one's the other doesn't):

function scheck_email($email)
{
if(!eregi("[A-Z0-9._%-]+@[A-Z0-9.-]{2}([A-Z0-9.-])?\.[A-Z]{2,4}",$email))
	return -1;	//	invalid
return 1;		//	valid
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.