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.

About 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.