验证email的正则表达式
原先是从月光博客获取的验证email的正则表达式,使用之后发现不理想,有些错误的email能通过验证,比如带两个'@'符号的,带'/'号的,带连续两个'.'的,带'>'符号的等等。
然后又去搜索,找到这两个正则表达式,需要一起用,原文出自:http://coding1688.iteye.com/blog/1501748
// define a regular expression for "normal" addresses
$normal = "^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$";
// define a regular expression for "strange looking" but syntactically valid addresses
$validButRare = "^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})$";