System.Web.UI.WebControls RegularExpressionValidator Class
Sets or retrieves the regular expression pattern used to validate a field.
Inline |
<asp:regularexpressionvalidator validationexpression = strRegEx ... > |
Script |
RegularExpressionValidator.ValidationExpression = strRegEx |
strRegEx |
String specifying the regular expression assigned as the validation criteria. |
The property is read/write with no default value.
Exception Type |
Condition |
HttpException |
The given regular expression is malformed. |
Use this property to specify the pattern used to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, and postal codes.
For syntax, see Regular Expressions Language Elements.
The following example demonstrates how to use the ValidationExpression property to validate a field with five numeric digits.
Show me
RegularExpressionValidator Members Validating Against Patterns