PatternRule

A validation rule that demands that the validated field match a specified pattern.

Type:

Object

To specify the regular expression that the validated field must match, set the rule's pattern configuration option.

Show Example:
AngularJS
Knockout
jQuery

In this example, the 'pattern' rule is applied to the 'Login' editor. This rule demands that the editor value has no digits. To check this rule, use digits when specifying a login.


                                    

                                    

In this example, the 'pattern' rule is applied to the 'Login' editor. This rule demands that the editor value has no digits. To check this rule, use digits when specifying a login.


                                    

                                    

In this example, the 'pattern' rule is applied to the 'Login' editor. This rule demands that the editor value has no digits. To check this rule, use digits when specifying a login.


                                    

                                    

message

Specifies the message that is shown for end-users if the current rule is broken.

Type:

String

Default Value: 'Value does not match pattern'

You do not have to specify this field. In this instance, a default message will be shown. To include the name of the validated editor into the default validation message as a subject, set the name field of the dxValidator object.

If you assign an empty string to the message field, the message will not be shown.

pattern

Specifies the regular expression that the validated value must match.

Type:

RegExp

|

String

type

Specifies the type of the current rule.

Type:

String

Accepted Values: 'pattern'

Set this field to 'pattern' to define a rule that will be broken if the validated value does not match the regular expression specified by the pattern configuration option.