Strong password validation using regular expression


This Regular expression is used to create strong password.

       It will allows to enter at-least  1 upper case letter.
       It will allows to enter at-least  1 lower case letter.
       It will allows to enter at-least  1 number or special character.
       It will allows to enter at-least 8 characters length.




<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="PasswordTextBox"  runat="server"></asp:TextBox> 
         
   <asp:RegularExpressionValidator ID="PasswordRegularExpressionValidator" runat="server"  
   ValidationExpression="(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$"
   ControlToValidate="PasswordTextBox" ErrorMessage="Invalid password">
   </asp:RegularExpressionValidator>
        
       </div>
    </form>
</body>


0 comments:

Post a Comment

Vikram Chandra Theme by BloggerThemes & NewWPThemes Sponsored by iBlogtoBlog