Archive

Posts Tagged ‘Regular Expressions’

How to find password strength using regular expression


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body>
    <form id="form1" runat="server">
        <asp:TextBox runat="server" ID="txtPassword" />
        <asp:RegularExpressionValidator runat="server" 
            ErrorMessage="Invalid Password" 
            ControlToValidate="txtPassword" 
            ID="regexPassword" 
            ValidationExpression="^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$" />
    </form>
</body>
</html>