RegEx由System.Net.Mail.MailAddress使用 [英] Is RegEx used by System.Net.Mail.MailAddress

查看:58
本文介绍了RegEx由System.Net.Mail.MailAddress使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试找到用于验证电子邮件的正则表达式。

I have been trying to find a good RegEx for email validation.

我已经经历过比较用于验证正则表达式的电子邮件地址,但这不足以满足我的所有验证需求。
我有Google / Bing(ed)并扫描前50个奇数结果,包括正则表达式信息文章和其他内容。

I have already gone through Comparing E-mail Address Validating Regular Expressions and that didn't suffice all my validation needs. I have Google/Bing(ed) and scan the top 50 odd results including regular expressions info article and other stuff.

所以最后我使用了 System.Net.Mail.MailAddress 类来验证我的电子邮件地址。因为,如果失败,我的电子邮件将不会发送给用户。

So finally i used the System.Net.Mail.MailAddress class to validate my email address. Since, if this fails, my email won't get sent to the user.

我想自定义类构造函数使用的验证。

I want to customize the validation as used by the constructor of the class.

那么我如何继续获取MailAddress类正在使用的验证/ RegEx?

So how do I go ahead and get the validation/RegEx that the MailAddress class is using?

推荐答案

感谢Reflector ...忘记了您仍然有空!

Thanks Reflector... forgot you were still free!

反映了System.Net.Mail.MailAddress ...

Reflected the System.Net.Mail.MailAddress...

发现它使用了 void ParseValue(字符串地址)

void GetParts(字符串地址)方法来主要检查邮件地址格式。

and void GetParts(string address) methods to primary check the mail address format.

//已编辑

很惊讶,没有涉及RegEx!

Surprised, no RegEx was involved!

这篇关于RegEx由System.Net.Mail.MailAddress使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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