我需要一个正则表达式来验证逗号分隔的电子邮件
我遵循实体框架代码的第一种方法。 我的一个模型中有关注的财产。 我想通过此正则表达式验证逗号分隔的电子邮件。 但这不正常。 例如:
。 //i.sstatic.net/cvbhk.png“ alt =”在此处输入图像描述”> 它在这里不起作用
[RegularExpression(@"^(\s?[^\s,]+@[^\s,]+\.[^\s,]+\s?,)*(\s?[^\s,]+@[^\s,]+\.[^\s,]+)$",ErrorMessage = "Invalid Email")]
[DisplayName("Participant List")]
public string ParticipantList { get; set; }
,但我想知道, 任何人都知道有效的正则表达式。我非常感谢。
谢谢。
I am following Entity framework code first approach.
I have following property in one of my models.
I want to validate comma separated emails by this regular expression.
But it is not working fine.
Ex:
As you can see it is validating here correctly.
[RegularExpression(@"^(\s?[^\s,]+@[^\s,]+\.[^\s,]+\s?,)*(\s?[^\s,]+@[^\s,]+\.[^\s,]+)quot;,ErrorMessage = "Invalid Email")]
[DisplayName("Participant List")]
public string ParticipantList { get; set; }
Anyone know any regular expression that works properly, i would like to know. I am highly appreciate it.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要在文本框中验证多个电子邮件,您可以使用以下正则表达式
For validating multiple emails in TextBox, you can use following regular expression
在REGEX匹配之后,如果发现任何电子邮件(如果昏迷也匹配后发出无效的电子邮件)
https:https:// regex101。 com/r/gzn1ny/1
这个与有效的电子邮件匹配的昏迷(如果任何电子邮件无效,则不匹配)
https://regex101.com/r/oz7gkd/1
following regex matched if any email found (if an invalid email come after coma matched too)
https://regex101.com/r/GZN1nY/1
this one matched to valid email separated by coma(not matched if any email is invalid)
https://regex101.com/r/Oz7GkD/1