什么是最简单的正则表达式验证电子邮件,不要盲目接受他们? [英] What is the simplest regular expression to validate emails to not accept them blindly?

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

问题描述

当用户创建我要让服务器验证的电子邮件不接受我的网站上的帐户的每个的输入。



我会送确认,在某种程度上做了握手验证



我要寻找的简单的东西,没有的,但不要太简单,不验证什么。我不知道在哪里限制必须的,因为任何正则表达式不会做正确的验证,因为是不可能的正则表达式来做到这一点。



我想限制sintax和视觉的复杂性固有的正则表达式,因为在这种情况下,任何将是正确的。



我可以使用哪些正则表达式来做到这一点?


解决方案

  ^ \S + @ \S + $ 




When users create an account on my site I want to make server validation for emails to not accept every input.

I will send a confirmation, in a way to do a handshake validation.

I am looking for something simple, not the best, but not too simple that doesn't validate anything. I don't know where limitation must be, since any regular expression will not do the correct validation because is not possible to do it with regular expressions.

I'm trying to limit the sintax and visual complexity inherent to regular expressions, because in this case any will be correct.

What regexp can I use to do that?

解决方案

^\S+@\S+$

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

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