class-validator-extended - v4.2.0
    Preparing search index...

    Function NotMatches

    • Checks if the given value is a string that does not match the given regular expression.

      // Ensure the value does not start with "foo".
      @NotMatches(/^foo/)
      value: string = 'bar'

      // Ensure the value does not include "foo", ignoring case.
      @NotMatches('foo', 'i')
      value: string = 'bar'

      Parameters

      • pattern: RegExp
      • Optionaloptions: ValidationOptions

      Returns PropertyDecorator

    • Checks if the given value is a string that does not match the given regular expression.

      // Ensure the value does not start with "foo".
      @NotMatches(/^foo/)
      value: string = 'bar'

      // Ensure the value does not include "foo", ignoring case.
      @NotMatches('foo', 'i')
      value: string = 'bar'

      Parameters

      • pattern: string
      • Optionalmodifiers: string
      • Optionaloptions: ValidationOptions

      Returns PropertyDecorator