Table of Contents

Class RegexValidator

Namespace
CloudyWing.FormValidators
Assembly
CloudyWing.FormValidators.dll

The regex validator.

public class RegexValidator : BasicFormValidator, IFormValidator
Inheritance
RegexValidator
Implements
Derived
Inherited Members

Constructors

RegexValidator(string, string, string, Func<string, string, string>)

Initializes a new instance of the RegexValidator class.

public RegexValidator(string column, string value, string pattern, Func<string, string, string> customErrorMessageAccessor = null)

Parameters

column string

The column.

value string

The value.

pattern string

The pattern.

customErrorMessageAccessor Func<string, string, string>

The custom error message accessor. The arguments are column, value.

Exceptions

ArgumentNullException

pattern

RegexValidator(string, string, Regex, Func<string, string, string>)

Initializes a new instance of the RegexValidator class.

public RegexValidator(string column, string value, Regex regex, Func<string, string, string> customErrorMessageAccessor = null)

Parameters

column string

The column.

value string

The value.

regex Regex

The regex.

customErrorMessageAccessor Func<string, string, string>

The custom error message accessor. The arguments are column, value.

Exceptions

ArgumentNullException

regex

Properties

DefaultErrorMessageAccessor

Gets the get default error message.

protected override Func<string, string, string> DefaultErrorMessageAccessor { get; }

Property Value

Func<string, string, string>

The get default error message.

Pattern

Gets the pattern.

public string Pattern { get; protected set; }

Property Value

string

The pattern.

RegexInstance

Gets or sets the regex instance.

protected Regex RegexInstance { get; set; }

Property Value

Regex

The regex instance.

Methods

ValidateValue()

Validates the value.

protected override bool ValidateValue()

Returns

bool

The validation result.