Skip to content

ValidatePatternAttribute class

namespace: Serenity.ComponentModel   assembly: Serenity.Net.Core

Requires a text to match a regular expression as a whole, which the forms also check. The expression is matched with ECMAScript semantics on the server, as the browsers match it, so it should only use what both have, e.g. no named groups or lookbehinds. An empty value is valid, as being required is RequiredAttribute's concern.

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public class ValidatePatternAttribute : RegularExpressionAttribute, IClientValidationRule, 
    IHasTextKey
parameter description
pattern The regular expression, without anchors, as the whole text has to match it.

Public Members

name description
ValidatePatternAttribute(…) Requires a text to match a regular expression as a whole, which the forms also check. The expression is matched with ECMAScript semantics on the server, as the browsers match it, so it should only use what both have, e.g. no named groups or lookbehinds. An empty value is valid, as being required is RequiredAttribute's concern.
Rule { get; }
RuleParams { get; }
Side { get; set; }
TextKey { get; set; }
override IsValid(…)
const Key The type key of the class of the rule on the client side, i.e. Serenity.PatternValidationRule.

Protected Members

name description
override IsValid(…)

See Also