I wish to validate an e-mail input string, so it's a valid email. And I wish to check the length of the e-mail string, so it isn't more than 60 characters. I'm using RegularExpressionValidator.. I have two of them, one to validate e-mail pattern, and one to validate length. But that doesn't seem to work. I can use one at a time with no problems, but if I use both of them, they both display error where there is no error.
Can these be combined? Or is there a better regualexpression that validates e-mail and length at the same time?
Controls:
<%-- Validate EmailAddress --%>
<asp:RequiredFieldValidator ID="EmailAddressRequiredFieldValidator" runat="server"
ErrorMessage="..." ControlToValidate="EmailAddressInsertTextBox" Display="None" ValidationGroup="InsertValidationGroup" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="EmailAddressInsertTextBox" ErrorMessage="......" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="None" ValidationGroup="InsertValidationGroup" />
<asp:RegularExpressionValidator ID="EmailAddressRegularExpressionValidator2" runat="server" ControlToValidate="EmailAddressInsertTextBox" ErrorMessage="..............." ValidationExpression="^[\w\s]{1,60}$" Display="None" ValidationGroup="InsertValidationGroup" />