@metreeca/core - v0.9.22
    Preparing search index...

    Function pattern

    • Constrains strings to a pattern.

      String patterns are read as regular expression sources and compiled with default flags; pass a RegExp instead to choose the flags, u among them. Matching is unanchored, so a pattern constrains the whole value only if it is anchored explicitly.

      Parameters

      • pattern: string | RegExp | undefined

        The pattern the value must match, or undefined to accept any value

      Returns Validator<string>

      A validator reporting a violation if the value does not match pattern