Sunday, May 7, 2017

Regular Expression in ASP.NET

<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Password"></asp:Label><asp:TextBox ID="PassTextBox"
            runat="server"></asp:TextBox><asp:RegularExpressionValidator ID="RegularExpressionValidator1"
                runat="server" ErrorMessage="Not" ControlToValidate="PassTextBox"
            EnableClientScript="False" SetFocusOnError="True"
            ValidationExpression="{/D,3}+{/W,3}"></asp:RegularExpressionValidator>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <br />
        email<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:RegularExpressionValidator ID="EmailRegularExpressionValidator2"
            runat="server" ControlToValidate="TextBox1" ErrorMessage="invalid email id"
            SetFocusOnError="True"
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
    </div>
    </form>
</body>

No comments:

Post a Comment