Regular Expression Validator Example: zip code : Zip Code « Validation by Function « ASP.Net






Regular Expression Validator Example: zip code


<%@ Page %>

<html>
<body>
<h1>Regular Expression Validator Example</h1>
<form runat="server">
Zipcode:<asp:TextBox id="_zipcode" runat=server/><asp:RegularExpressionValidator
     ControlToValidate="_zipcode"
  Display="static"
  ErrorMessage="Zip code must be of the form 11111-1111"
  InitialValue="" width="100%" runat=server
  ValidationExpression="\d{5}(-\d{4})?">**
</asp:RegularExpressionValidator>
<br/>
<input value="Enter" type=submit />
</form>
</body> </html>

           
       








Related examples in the same category

1.Using a RegularExpressionValidator Control to Test a Zip Code (VB.net)
2.Using a RegularExpressionValidator Control to Test a Zip Code with validationexpression (VB.net)