ASP.NET MVC的Web API数据标注定期EX pression电子邮件 [英] ASP.NET MVC Web API data annotation regular expression for email

查看:125
本文介绍了ASP.NET MVC的Web API数据标注定期EX pression电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 [RegularEx pression(@^ [A-ZA-Z0-9 ._%+ - ] + @ [A-ZA-Z0-9 .-] + \\。 [A-ZA-Z] {2,4} $)] 属性从来没有验证我的模型的email属性。我是新来定期EX pressions所以我无法弄清楚是什么问题。一点帮助?

Using [RegularExpression(@"^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$")] attribute never validates an email property of my model. I'm new to regular expressions so I can't figure out what is the problem. Little help?

推荐答案

看看这篇文章:<一href=\"http://www.mkyong.com/regular-ex$p$pssions/how-to-validate-email-address-with-regular-ex$p$pssion/\"相对=nofollow>如何验证电子邮件地址与普通防爆pression 。这家伙不仅为您提供正规前pression,也解释一步一步意味着什么。它不仅是一个有用的前pression,但你也可以从本文学到一两件事。

Look at this article: How To Validate Email Address With Regular Expression. The guy not only providing you with the regular expression, but also explaining step by step what it means. Not only its useful as an expression, but you can also learn a thing or two from this article.

希望这有助于。请让我知道,如果没有。

Hope this helps. Please let me know if not.

这篇关于ASP.NET MVC的Web API数据标注定期EX pression电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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