Function: pattern()
Imported from
@react-logic/utilspattern<
N>(regex,message?,name?):ValidatorEntry<string> &object
Defined in: utils/src/lib/forms-validators.ts:93
String must match regex. Pairs with the HTML pattern attribute —
mirrors regex.source (flags ignored, which matches HTML semantics).
Two pattern() validators on one field need distinct names — pass the
third arg to disambiguate:
validators: [
pattern(/[A-Z]/, 'Needs uppercase', 'uppercase'),
pattern(/\d/, 'Needs digit', 'digit'),
]
// errors.password.uppercase, errors.password.digit
Type Parameters
N
N extends string = "pattern"
Parameters
Returns
ValidatorEntry<string> & object