您验证电子邮件的最佳正则表达式是什么? [英] What's the best regular expression you have or have seen for validating emails?

查看:84
本文介绍了您验证电子邮件的最佳正则表达式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法开发适用于大多数电子邮件地址的正常表达式。我经常会找到一个无法注册的用户,这可能意味着有很多人甚至都不会打扰。


我见过几个解决方案使用使用几个较短表达式的函数,但我宁愿在一个简单函数中使用一个长复杂表达式,而不是在一个更复杂的函数中使用几个短表达式。

解决方案

< blockquote>你为什么不在这里给出你当前的表达?


并且,也许是一个什么样的地址失败的例子?


要查找一个人可以使用谷歌的表达.....


要找到一个比谷歌更好的表达方式,分享你正在使用的东西,指出为什么会失败,改善你自己的尝试使你当前的解决方案更好....


试试这个:

展开 | 选择 | Wrap | 行号


如果找不到电子邮件地址,您的代码将失败,如果少于三个地址发现:

展开 | 选择 | Wrap | 行号


I am having trouble developing a good regular expression that works for most email addresses. Every so often I will get a user who can''t register and that probably means there are quite a few that don''t even bother.

I''ve seen several solutions that use functions that use several shorter expressions, but I''d rather have one long complex expression in a simple function instead of several short expression in a more complex function.

解决方案

Why do you not give your current expression here?

And, maybe an example of what kind of addresses fail?

To find an expression one could use Google.....

To find a better expression than found on Google, share what you are using, point out why this if failing, improve your own attempts to make your current solution better ....


Try this:

Expand|Select|Wrap|Line Numbers


you code fails if there are NO email addresses found, and if less than three addresses are found:

Expand|Select|Wrap|Line Numbers


这篇关于您验证电子邮件的最佳正则表达式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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