开发者

Email Regex Validator, not allowing "."

开发者 https://www.devze.com 2023-03-09 10:29 出处:网络
Hey I have the following Regex Validator <asp:RegularExpressionValidator ID=\"RegularExpressionValidator1\" runat=\"server\" ControlToValidate=\"email\"

Hey I have the following Regex Validator

<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="email"
                ErrorMessage="Email requires a vaild email address" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>

But its not allowing the follow mail e.clear@c开发者_运维技巧ompany.ie , I believe the issue is with the . before the @ symbol, but not sure how to update the regex to reflect this


Use this:

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

This is the default regular expression provided with RegularExpressionValidator. Yours expression have a ' after 8th char. It seems to be invalid.


i think its working for e.clear@company.ie. But you are not given the validation group.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号