[Solved] Email Regular Expression not working with RegularExpressionValidator In ASP.Net

Last Reply 24 days ago By Mudassar

Posted 24 days ago

Hello Forum,

I tried to make my email textbox to accept valid email address with Regular Expression Validator. But when I insert a valid email address, the validator error message still shows that the email is not valid. Please how can I resolve this?

HERE IS THE VALIDATION EXPRESSION I USED:

  <label for="txtUsername">Email</label>
   <asp:TextBox ID="mailtxtbx" runat="server" CssClass="form-control" placeholder="Email Address" />
   <asp:RegularExpressionValidator ID="Regex" runat="server" Font-Size="X-Small" ErrorMessage="Please provide a Valid Mail Address" Font-Bold="true" ValidationExpression="/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;" ControlToValidate="mailtxtbx" ForeColor="Red"></asp:RegularExpressionValidator>

 

You are viewing reply posted by: Mudassar 24 days ago.