Regex Method

Validator.Regex Method

Defines a validation test that tests a value against a pattern specified as a regular expression.

Namespace:  System.Web.WebPages
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

public static IValidator Regex(
	string pattern,
	string errorMessage
)

Parameters

pattern
Type: System.String
The regular expression to use to test the user input.
errorMessage
Type: System.String
The error message to display if validation fails.

Return Value

Type: System.Web.WebPages.IValidator
The validation test.

This test lets you define validation tests for values that are not covered by existing validation tests.

Show:
© 2016 Microsoft