PEAR::Mail_RFC822から抜き出したメールアドレスの正規表現による判定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isValidInetAddress($data, $strict = false){ | |
// 次の行は、表示改行されていますが実際は一行です | |
$regex = $strict ? ' /^([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})$/i ' : | |
' /^([*+!.&#$|\'\\%\/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