Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "src/validators/regex"

Index

Variables

Functions

Variables

Const re

re: regex = regex

Functions

regex

  • Validates that the specified value matches an regular expression. If pattern is a string, then a regex is created with new RegExp(pattern).

    example
    regex(/^[0-9a-z_]+$/i)
    regex("^[0-9a-zA-z_]+$")
    regex(/^[0-9a-z_]+$/i, {message: "must be a valid username"})
    example
    useForm(({confirm}) => ({
      email: [regex(/^\S+@\S+$/)]
    }));

    Type parameters

    • Params

    Parameters

    • pattern: string | RegExp

      The expected pattern.

    • Optional options: RuleOptions

      The validator options.

    Returns Validator<Params>

    The validation object.

Generated using TypeDoc