RegularEx pressionValidator了多封电子邮件 [英] RegularExpressionValidator for multiple emails

查看:129
本文介绍了RegularEx pressionValidator了多封电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为验证有效的电子邮件文本框与此:

 < ASP:RegularEx pressionValidator ID =RegularEx pressionValidator1
的ControlToValidate =txtMailCustom
文本=无效地址
ValidationEx pression =^([A-ZA-Z0-9 _ \\ - \\] +)。@((\\ [[0-9] {1,3} \\ [0-9] {1,3 } \\。[0-9]
{1,3} \\)|(([A-ZA-Z0-9 \\ - ] + \\。)+))([A-ZA-Z] {2,4} | [0-9] {1 ?,3})(\\])$=服务器/>

现在我希望用户能够将多个电子邮件地址,用逗号和空格分隔。

我如何整合这一行为?


解决方案

试试这个前pression:

<$p$p><$c$c>^(\\s*,?\\s*[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+[a-zA-Z]{2,9})+\\s*$

I'm validating a textbox for valid email with this:

<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
ControlToValidate="txtMailCustom"
Text="Invalid address"
ValidationExpression="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]
{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" runat="server" />

Now I want users to be able to put multiple email addresses , separated by a comma and space.

How can I integrate that behaviour ?

解决方案

try this expression:

^(\s*,?\s*[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})+\s*$

这篇关于RegularEx pressionValidator了多封电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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