Validating Expressions

What if you need to verify that text someone has entered is a correctly formatted Canadian postal code? What if you need a user to enter a valid e-mail address? Although you could write the necessary code to validate these types of expressions (and many ASP developers did just that), ASP.NET makes it easy to validate complex expressions.

Using the power of regular expressions, a widely accepted standard for generalizing pattern matching, ASP.NET provides the RegularExpressionValidator control. This control allows you to specify a regular expression to match against text entered into a control. (Regular expressions are templates for matching text—the DOS wildcards, * and ?, allow you to create very simple regular expression-like ...

Get ASP.NET Developer's JumpStart now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.