Condividi tramite


ValidatePatternAttribute Class

Definition

Validates that each parameter argument matches the RegexPattern.

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

Constructors

ValidatePatternAttribute(String)

Initializes a new instance of the ValidatePatternAttribute class.

Properties

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

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

RegexPattern

Gets the Regex pattern to be used in the validation.

Methods

Validate(Object, EngineIntrinsics)

Calls ValidateElement in each element in the enumeration argument value.

(Inherited from ValidateEnumeratedArgumentsAttribute)
ValidateElement(Object)

Abstract method to be overridden by subclasses, implementing the validation of each parameter argument.

(Inherited from ValidateEnumeratedArgumentsAttribute)

Applies to