Skip to content

Instantly share code, notes, and snippets.

@githiro
Last active December 18, 2015 13:09
Show Gist options
  • Select an option

  • Save githiro/5787413 to your computer and use it in GitHub Desktop.

Select an option

Save githiro/5787413 to your computer and use it in GitHub Desktop.
PHP: isVaildInetAddress - PEAR Class Mail_RFC822(not strict mode only)
function isValidInetAddress($data)
{
$regex = '/^([*+!.&#$|\'\\%\/0-9a-z^_`{}=?~:-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/i';
if (preg_match($regex, trim($data), $matches))
{
return array($matches[1], $matches[2]);
}
else
{
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment