如何编写正则表达式来匹配免费电子邮件帐户? [英] How to write regular expression to match free email accounts?

查看:113
本文介绍了如何编写正则表达式来匹配免费电子邮件帐户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个正则表达式,检查电子邮件表单字段是否包含一个免费的电子邮件地址,没有运气。



本质上我需要检查该电子邮件包含: hotmail yahoo gmail 等电子邮件字段。

解决方案

正则表达式将如下所示:

  [a-zA-Z0-9_\。+] + @(gmail | yahoo | hotmail)(\。[az] {2,3}){1,2} 

你可以添加所有其他你想要的域名...
有帮助吗? / p>

I'm trying to write a regular expression that checks if an email form field contains a free email address, with no luck.

Essentially I need to check if the email contains: hotmail, yahoo, gmail etc in the email field.

解决方案

regex would be sth like:

[a-zA-Z0-9_\.+]+@(gmail|yahoo|hotmail)(\.[a-z]{2,3}){1,2}

you can add all the other domains you want... does it help you?

这篇关于如何编写正则表达式来匹配免费电子邮件帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆