# excludes

> This document is the Markdown version of [valibot.dev/api/excludes/](https://valibot.dev/api/excludes/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates an excludes validation action.

```ts
const Action = v.excludes<TInput, TRequirement, TMessage>(requirement, message);
```

## Generics

- `TInput` `extends ContentInput`
- `TRequirement` `extends ContentRequirement<ContentInput>`
- `TMessage` `extends ErrorMessage<ExcludesIssue<TInput, TRequirement>> | undefined`

## Parameters

- `requirement` `TRequirement`
- `message` `TMessage`

### Explanation

With `excludes` you can validate the content of a string or array. If the input does not match the `requirement`, you can use `message` to customize the error message.

## Returns

- `Action` `ExcludesAction<TInput, TRequirement, TMessage>`

## Examples

The following examples show how `excludes` can be used.

### String schema

Schema to validate that a string does not contain a specific substring.

```ts
const StringSchema = v.pipe(
  v.string(),
  v.excludes('foo', 'The string must not contain "foo".')
);
```

### Array schema

Schema to validate that an array does not contain a specific string.

```ts
const ArraySchema = v.pipe(
  v.array(v.string()),
  v.excludes('foo', 'The array must not contain "foo".')
);
```

## Related

The following APIs can be combined with `excludes`.

### Schemas

[`any`](/api/any.md), [`array`](/api/array.md), [`custom`](/api/custom.md), [`instance`](/api/instance.md), [`string`](/api/string.md), [`tuple`](/api/tuple.md), [`unknown`](/api/unknown.md)

### Methods

[`pipe`](/api/pipe.md)

### Utils

[`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)
