ASP.NET电子邮件验证器正则表达式 [英] ASP.NET email validator regex

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

问题描述

有没有人知道ASP.NET中的电子邮件验证器使用的regex是什么?

解决方案

这是正则表达式 Internet电子邮件地址使用.NET中的 RegularExpressionValidator

  \ w +([ -  +。'] \w +)* @ \w +([ - 。] \w +)* \.\w +([ - 。] \w +)* 

顺便说一下,如果您在页面上放置了 RegularExpressionValidator ,然后转到设计视图, strong> ValidationExpression 字段,可用于从.NET提供的表达式列表中进行选择。一旦你选择了你想要的表达式,就会有一个验证表达式:保存用于验证器的正则表达式的文本框


Does anyone know what the regex used by the email validator in ASP.NET is?

解决方案

Here is the regex for the Internet Email Address using the RegularExpressionValidator in .NET

\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

By the way if you put a RegularExpressionValidator on the page and go to the design view there is a ValidationExpression field that you can use to choose from a list of expressions provided by .NET. Once you choose the expression you want there is a Validation expression: textbox that holds the regex used for the validator

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

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