Search
Syndication
Sponsors

Archive for the ‘Regular Expressions’ Category

Match an email address

Sunday, February 14th, 2010

$match = ‘/^[^0-9][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[@][a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)*[.][a-zA-Z]{2,4}$/’;

preg_match($match, $email);

Is IP valid

Thursday, June 25th, 2009

function ValidIP($ip){

if (preg_match(’/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/’, $ip)){
return true;
}

return false;
}

Valid Email Address

Monday, June 8th, 2009

A function to check if an email address is valid

function valid_email($email)
{
if(preg_match(”/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/”, $email) > 0)
return true;
else
return false;
}