# multimatch

> Extends `minimatch.match()` with support for multiple patterns

Latest version **8.0.0** (published 2026-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install multimatch
pnpm add multimatch
yarn add multimatch
bun add multimatch
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 8.0.0 |
| Published | 2026-02-20 |
| First published | 2014-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 3 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 306 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | expand, find, glob, globbing, globs, match, matcher, minimatch, pattern, patterns, wildcard |

## Links

- npm: https://www.npmjs.com/package/multimatch
- Repository: https://github.com/sindresorhus/multimatch
- Homepage: https://github.com/sindresorhus/multimatch#readme
- Issues: https://github.com/sindresorhus/multimatch/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/multimatch

## Dependencies (3)

- [minimatch](https://npm.io/package/minimatch.md) ^10.2.2
- [array-union](https://npm.io/package/array-union.md) ^3.0.1
- [array-differ](https://npm.io/package/array-differ.md) ^4.0.0

## Recent versions

- 8.0.0 (latest) — 2026-02-20
- 7.0.0 — 2023-10-27
- 6.0.0 — 2021-10-18
- 5.0.0 — 2020-10-12
- 4.0.0 — 2019-04-22
- 3.0.0 — 2018-12-19
- 2.1.0 — 2015-11-14
- 2.0.0 — 2014-12-22
- 1.0.1 — 2014-11-23
- 1.0.0 — 2014-09-22
- 0.3.0 — 2014-06-21
- 0.2.0 — 2014-05-19
- 0.1.0 — 2014-01-15

## README

# multimatch

> Extends [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) with support for multiple patterns

## Install

```sh
npm install multimatch
```

## Usage

```js
import multimatch from 'multimatch';

multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']);
//=> ['unicorn', 'rainbows']
```

See the [tests](test) for more usage examples and expected matches.

## API

### multimatch(paths, patterns, options?)

Returns an array of matching paths in the order of input paths.

#### paths

Type: `string | string[]`

The paths to match against.

#### patterns

Type: `string | string[]`

Globbing patterns to use. For example: `['*', '!cake']`. See supported [`minimatch` patterns](https://github.com/isaacs/minimatch#usage).

- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)
- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)

#### options

Type: `object`

See the [`minimatch` options](https://github.com/isaacs/minimatch#options).

## How multiple patterns work

Positive patterns (e.g. `foo` or `*`) add to the results, while negative patterns (e.g. `!foo`) subtract from the results.

Therefore a lone negation (e.g. `['!foo']`) will never match anything. Use `['*', '!foo']` instead.

## Globbing patterns

Just a quick overview.

- `*` matches any number of characters, but not `/`
- `?` matches a single character, but not `/`
- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
- `{}` allows for a comma-separated list of "or" expressions
- `!` at the beginning of a pattern will negate the match

## Related

- [globby](https://github.com/sindresorhus/globby) - Match against the filesystem instead of a list
- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching

---
_Source: https://npm.io/package/multimatch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
