Data Driven Forms provides a pattern validator that uses regular expression to check the value.

import validatorTypes from '@data-driven-forms/react-form-renderer/validator-types';
{
type: validatorTypes.PATTERN,
pattern: /\d+/
}

string | regEx

To set a pattern you can use a string variant or a regEx.

i.e.

  • string: \d+
  • regEx: /\d+/

string

Sets flags used in the regular expression.

i.e.

  • i - case-insensitive