I’m looking to accept values of (6 chars long or nothing).
This is for an update form. If a password is entered, I’d like to force 6 chars long. If not, I want to ignore the field.
Here’s a REGEX that gets me the 6 char part, any help on handling empty also?
<asp:RegularExpressionValidator id="rev1" runat="server" SetFocusOnError="True"
ErrorMessage="Password must be 6 characters long" Display="Dynamic"
ControlToValidate="TextBox1" ValidationExpression="^[a-zA-Z0-9]{6}$">
Not sure if i got your question right but RegularExpressionValidator does not validate empty inputs. In other words, if TextBox1 is empty Page.IsValid will be true.