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
columnstringThe column.
valuestringThe value.
patternstringThe pattern.
customErrorMessageAccessorFunc<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
columnstringThe column.
valuestringThe value.
regexRegexThe regex.
customErrorMessageAccessorFunc<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
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.