Asp.Net Regular Expression Example
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat ="server" >
</asp:TextBox>
<asp:RegularExpressionValidator ID="re1" runat ="server" ControlToValidate ="TextBox1" ErrorMessage ="Invalid Mail"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="Button1" runat ="server" Text ="Check" />
</form>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat ="server" >
</asp:TextBox>
<asp:RegularExpressionValidator ID="re1" runat ="server" ControlToValidate ="TextBox1" ErrorMessage ="Invalid Mail"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="Button1" runat ="server" Text ="Check" />
</form>
</body>
</html>
Comments
Post a Comment