Validation Controls[3]->RegularExpressionValidator

The RegularExpressionValidator control confirms that the entry matches a pattern defined by a regular expression. This type of validation allows you to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so on.

RegularExpressionValidator uses two key properties to perform its validation: ControlToValidate contains the value to validate, and ValidationExpression contains the regular expression to match.

The following sample illustrates using the RegularExpressionValidator control.

C# RegExValidator1.aspx
Run Sample View Source

For a detailed discussion of Web Forms validation, please see the Validating Form Input Controls section of this QuickStart tutorial.

posted on 2007-05-14 09:57  改变热爱  阅读(112)  评论(0)    收藏  举报

导航