Shown below is the Regular Expression to validate the following Password requirements:
· Password is at least 7 characters in length
· Password contains at least one non-alphanumeric character
<asp:RegularExpressionValidator ID="revValidatePwd" runat="server" ControlToValidate="txtNewPwd"
ErrorMessage="Password must be 7 characters in length and include one non-alphanumeric character."
ToolTip="Password must be 7 characters in length and include one non-alphanumeric character."
ValidationGroup="ChangePwdValidation" ValidationExpression="^(?=.*(\W)).{7,}$">*</asp:RegularExpressionValidator>
1 comment:
We wanted user to enter the following character as well _ (underscore) and length to be 8
so we used the following expression
^(?=.*[(\W)_]).{8,}$
Thanks Kiran
Post a Comment