ValidatePatternAttribute ValidatePatternAttribute ValidatePatternAttribute Class


Validates that each parameter argument matches the RegexPattern

[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)]
public sealed class ValidatePatternAttribute : System.Management.Automation.ValidateEnumeratedArgumentsAttribute
type ValidatePatternAttribute = class
    inherit ValidateEnumeratedArgumentsAttribute
Public NotInheritable Class ValidatePatternAttribute
Inherits ValidateEnumeratedArgumentsAttribute


ValidatePatternAttribute(String) ValidatePatternAttribute(String) ValidatePatternAttribute(String)

Initializes a new instance of the ValidatePatternAttribute class


ErrorMessage ErrorMessage ErrorMessage

Gets or sets the custom error message pattern that is displayed to the user.

The text representation of the object being validated and the validating regex is passed as the first and second formatting parameters to the ErrorMessage formatting pattern. [ValidatePattern("\s+", ErrorMessage="The text '{0}' did not pass validation of regex '{1}'")]

Options Options Options

Gets or sets the Regex options to be used in the validation

RegexPattern RegexPattern RegexPattern

Gets the Regex pattern to be used in the validation


Validate(Object, EngineIntrinsics) Validate(Object, EngineIntrinsics) Validate(Object, EngineIntrinsics) Inherited from ValidateEnumeratedArgumentsAttribute
ValidateElement(Object) ValidateElement(Object) ValidateElement(Object) Inherited from ValidateEnumeratedArgumentsAttribute

Applies to