API Reference

minimatch

A minimal matching utility that compiles glob patterns into anchored JavaScript RegExp objects.

Official Documentation ↗
CompatibilityThis documentation covers version v9. Check the official docs for the latest API surface.

Installation

npmnpm install minimatch

Methods

minimatch translates glob syntax into regular expressions and is used by npm, glob, and many build tools.

Key Features

  • Single-call matching or compiled reusable Matcher
  • Globstar, negation, and brace expansion
  • Extglob and regexp features can be toggled off

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/isaacs/minimatch@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:56.598Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

Security notes

Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://cdn.jsdelivr.net/gh/isaacs/minimatch@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:56.598Z.

FAQ

How is minimatch different from a plain RegExp?
minimatch translates *, **, ?, [], and {a,b} into an anchored RegExp and applies path segment semantics, which raw RegExp does not.
Does ** cross directory boundaries?
Yes. globstar matches zero or more path segments, so a/**/b matches a/b, a/x/b, and a/x/y/b.
Can I disable brace expansion?
Set noext: true to disable {a,b} expansion and noglobstar: true to treat ** as a single path segment.