Glob Pattern Tester
Pattern Explanation
**/Match any directory depth (zero or more directories)*Match any characters except /.tsLiteral: ".ts"Results6 matched / 19 unmatched
What This Tool Does
Paste one or more glob patterns and a list of file paths to see which paths match in real time, with a token-by-token explanation of the pattern. Matching runs entirely in your browser. Remember that a single * never crosses a directory separator — use **/*.ts, not *.ts, to match TypeScript files in subdirectories.
Last updated:
This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.
Agent Invocation
Best Path For Builders
Browser workflow
Runs instantly in the browser with private local processing and copy/export-ready output.
Browser Workflow
This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.
/glob-pattern-tester/
For automation planning, fetch the canonical contract at /api/tool/glob-pattern-tester.json.
How to Use Glob Pattern Tester
- 1
Test .gitignore patterns before committing
Enter glob patterns (e.g., '*.log', 'node_modules/**', 'dist/*.js') and test against actual file paths you want to ignore. Verify the pattern matches your intent before adding to .gitignore.
- 2
Build file matching rules for build tools
Write webpack entry patterns or TypeScript include/exclude paths. Test glob patterns like 'src/**/*.tsx' against your file tree to ensure bundler catches exactly what you want.
- 3
Validate backup exclusion patterns
If backing up a project, test glob patterns to exclude large directories ('node_modules/**', '.git/**'). Confirm the tester shows 0 matches for paths you want to skip.
- 4
Test nested wildcard matching for multi-level directories
Patterns like 'src/**/components/*.tsx' or 'tests/**/__snapshots__/**' can be tricky. Use the tester to verify ** correctly matches any depth, not one level.
Frequently Asked Questions
What is a glob pattern?
What does ** mean in a glob?
Why do .gitignore patterns work differently?
Can I test multiple patterns at once?
Is this tool free?
How do I test a glob pattern against file paths online?
Enter a pattern such as **/*.ts and a list of file paths, one per line, or load the sample project tree. Every path is checked against the pattern in the page itself and immediately sorted into matched and unmatched, with a per-token explanation of what each part of the pattern does.
Step by step
- Type the glob pattern. The explanation panel breaks it into tokens (
**/,*, literals) and states what each one matches. - Paste your file paths one per line, or click Sample File Tree for a realistic project layout including
node_modulesand dot files. - Toggle Case Sensitive and Include Dot Files to mirror your build tool's behavior.
- Enable Multi-pattern mode to test several patterns at once — including
!exclusions — and read the per-file match matrix. - Copy the matched and unmatched lists as JSON.
Glob token reference
| Token | Matches |
|---|---|
| * | Any characters within one path segment — never crosses / |
| ? | Exactly one character, excluding / |
| ** | Everything, including path separators |
| **/ | Any directory depth, including zero directories — **/*.md also matches a root-level README.md |
| [abc] / [!abc] | One character from the set, or any character not in the set |
| {ts,tsx} | One of the listed alternatives; nested braces are expanded |
| !pattern | Negation — excludes files the rest of the pattern would match |
Token semantics as implemented in this tool's matcher. Glob dialects differ — .gitignore, bash, and minimatch each handle edge cases like negation order and bare ** slightly differently.
Why doesn't *.ts match files in subdirectories?
Because * stops at the directory separator. *.ts matches index.ts but not src/index.ts. To match at any depth, prefix with the globstar: **/*.ts. This is the single most common reason a pattern that "should" work matches nothing in a tsconfig, ESLint, or CI include list.
How do dot files and negated patterns behave?
By default, paths with a segment starting with . (like .env or .gitignore) are excluded unless the pattern itself explicitly starts with a dot or contains /. — enable Include Dot Files to override that. A pattern starting with ! excludes its matches; when every active pattern is a negation, files are matched against an implicit **/* base so the exclusions apply to everything else.
Do my file paths leave the browser?
No. Patterns are compiled to regular expressions and tested in the page; nothing is uploaded or stored. File paths reveal project structure, internal codenames, and sometimes credentials in file names, so a local-only tester is the safe way to debug ignore rules against a real tree.