Skip to content
gohacks.dev
Tooling

Glob Pattern Tester

Test glob patterns with *, **, ?, character classes, braces and ! negation against a list of paths, and see which pattern decided each one.

Free · No sign-up · Your inputs stay in your browser

Input

Test glob patterns against paths

Output

2 of 6 match

PathResultDecided by
src/index.tsmatchsrc/**/*.{ts,tsx}
src/components/Button.tsxmatchsrc/**/*.{ts,tsx}
src/components/Button.test.tsno!src/**/*.test.ts
src/.cache/x.tsno-
README.mdno-
tests/app.tsno-
src/**/*.{ts,tsx}^src\/(?:(?!\.)[^/]*\/)*(?!\.)[^/]*\.(?:ts|tsx)$
!src/**/*.test.ts^src\/(?:(?!\.)[^/]*\/)*(?!\.)[^/]*\.test\.ts$

* matches within one path segment and ** across any number of them; ? is one character, [abc] a set and {a,b} alternatives. This follows the shared core of minimatch, fast-glob and Bash globstar. .gitignore differs: a pattern without a slash matches at any depth, and a trailing slash matches directories only.

Runs in this browser. Nothing you paste is sent to a server.

One star or two

src/* matches files directly in src; src/** matches everything below it at any depth, and src/**/*.ts every TypeScript file in the tree. Dotfiles are skipped unless the pattern names the dot or dotfiles are enabled, which is the default in Bash, minimatch and fast-glob, and the reason .env survives a rm *.

Where globs differ

Tools agree on this core and differ at the edges. .gitignore matches a pattern without a slash at any depth and treats a trailing slash as directories only. Bash needs shopt -s globstar for **. Docker's .dockerignore follows Go's filepath.Match rules plus **. Test against the tool that will read the pattern.

Share

Frequently asked questions

What is the difference between * and ** in a glob?
* matches any characters within one directory level; ** matches any number of levels, including none.
How do I exclude files in a list of globs?
Start a pattern with !. Patterns are applied in order, so put the exclusion after the pattern it narrows.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools