验证表达式也接受 ENTER
我在验证用逗号或分号分隔的多封电子邮件时运气不佳。
ValidationExpression="(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([;: ]+)?)+"
当多个电子邮件用逗号或冒号分隔时,此验证工作正常,但我也需要更多来绕过 ENTER 输入。意味着用户在写完每封电子邮件后按回车键。 我如何修改上面的表达式,以便它可以吃 Enter 以及逗号和分号,
提前致谢
在 asp.net 中使用它。
am having a bad luck in validation of multiple emails seprated with comma Or Semi colon.
ValidationExpression="(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([;: ]+)?)+"
This validation works fine when multiple email separated with comma OR colon, but what i need more to bypass ENTER input too. Means if user hits enter after writing each emails.
How can i modify above expression so that it can eat Enter as well as comma and semi colon,
Thanks in advance
Using this in asp.net .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我真的不明白它如何与逗号一起使用,但这应该使它可以与多行一起使用。
如果您希望它适用于逗号,我认为它需要是这样的:
我应该指出,我没有做任何事情来验证这是否实际上是用于验证电子邮件地址的良好正则表达式。我刚刚添加了所需的功能。
我强烈推荐正则表达式教练来帮助您构建正则表达式。
我还强烈推荐 http://www.regular-expressions.info/ 作为参考。
I don't really see how that works with commas but this should make it work with multiple lines.
If you want it to work for commas I would think it would need to be this:
I should point out that I did not do anything to validate whether or not that was actually a good regex for validating email addresses. I just added the requested functionality.
I highly recommend The Regex Coach to help you build regex.
I also highly recommend http://www.regular-expressions.info/ as a reference.