Glob Pattern Tester (* ** ? [...])

Glob patterns are used by bash, .gitignore, Git, Webpack, Rsync, and most build tools to match filenames — but the semantics vary slightly between implementations. Will **/*.test.ts match src/foo.test.ts? Will node_modules/ in .gitignore match nested node_modules/ too? Paste a list of paths and test patterns against them.

How to use the Glob Pattern Tester (* ** ? [...])

Add patterns (one per line). Negation with leading ! excludes paths that matched a previous pattern. Test paths in the second box. The output table shows which patterns matched which paths.

What is the Glob Pattern Tester (* ** ? [...])?

Glob patterns are simpler than regex but powerful enough for file matching. Supported metacharacters:

  • * — matches anything except /. *.js matches foo.js but not src/foo.js.
  • ** — matches anything including / (when between slashes or at start/end). **/*.js matches foo.js and src/foo.js.
  • ? — matches one character.
  • [abc] — character class. [!abc] negation.
  • {a,b,c} — brace expansion (see our brace expander).

Notable differences:

  • .gitignore: trailing / matches directories only; leading / anchors to repo root; no leading slash matches anywhere.
  • Bash: ** requires shopt -s globstar in some versions.
  • fnmatch (POSIX): no **; * behaves like the bash * across slashes.

This tester uses the minimatch-style semantics (the de-facto standard from Node's ecosystem) which is what Git, Prettier, ESLint, and most modern tools use.

Frequently asked questions

What is the difference between * and **?

A single asterisk matches within one path segment and stops at a slash, while a double asterisk matches across slashes into nested directories. So a double-asterisk pattern matches files at any depth.

Why do my results differ from my shell?

Glob semantics vary between bash, git and build tools, especially around dotfiles and trailing slashes. Pick the implementation that matches your context to test it accurately.

Can I test .gitignore patterns?

Yes. Paste your paths and patterns to see what matches, which is the quickest way to find a stray rule that is ignoring or un-ignoring the wrong files.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: