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