StevieB
StevieB

Reputation: 6533

Email Regex Validator, not allowing "."

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 [email protected] , I believe the issue is with the . before the @ symbol, but not sure how to update the regex to reflect this

Upvotes: 1

Views: 442

Answers (2)

Breno Mansur Rabelo
Breno Mansur Rabelo

Reputation: 153

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.

Upvotes: 1

Mahesh KP
Mahesh KP

Reputation: 6446

i think its working for [email protected]. But you are not given the validation group.

Upvotes: 0

Related Questions