Regular expression validator. The regular expression applies to the full string only if constructed as such. For example, /\d*/ (0 or more digits) matches every string, /\d+/ (1 or more digits) matches strings with at least one digit, /^\d*$/ matches strings that are all digits or empty, and /^\d+$/ matches strings that are all digits and not empty.

Clients of this class are recommended to override the createErrorMessage method create a more suitable error message for their use case.

Implements

Constructors

Accessors

Methods

Constructors

Accessors

Methods

  • Create an error message for a string. The generic error message is sufficient for many use cases but a more domain-specific error message, possibly including the pattern itself, is often required.

    Parameters

    • s: string

      String.

    Returns string

    Error message.