Home  >  Article  >  Backend Development  >  关于邮箱验证的有关问题,请高手帮忙看一下

关于邮箱验证的有关问题,请高手帮忙看一下

WBOY
WBOYOriginal
2016-06-13 13:25:261046browse

关于邮箱验证的问题,请高手帮忙看一下
if (!ereg("^[a-zA-Z0-9_.]+@([a-zA-Z0-9_]+.)+[a-zA-Z]{2,3}$", $email)){



帮看看这个有问题吗?能验证所有规则的邮箱吗?
gsgsg@xx.com
gsdg.ee@xx.com.cn
tert_erw@xx.com

另外邮箱中一般都是下划线“_”,但今天有人提出也有“-”这种划线的邮箱,请问以上代码如何修改可以让带有“-”这种划线的邮箱也通过?
rgter-fsf@xx.com

------解决方案--------------------
if (!ereg("^[a-zA-Z0-9_.-]+@([a-zA-Z0-9_]+.)+[a-zA-Z]{2,3}$", $email)){

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn