Skip to content

Glob Pattern Tester

Pattern Explanation

**/Match any directory depth (zero or more directories)
*Match any characters except /
.tsLiteral: ".ts"

Results6 matched / 19 unmatched

src/index.ts
src/App.tsx
src/components/Header.tsx
src/components/Footer.tsx
src/components/ui/Button.tsx
src/components/ui/Modal.tsx
src/hooks/useAuth.ts
src/hooks/useTheme.ts
src/utils/helpers.ts
src/utils/format.ts
src/__tests__/App.test.tsx
src/__tests__/helpers.test.ts
package.json
tsconfig.json
README.md
.env
.gitignore
node_modules/react/index.js
node_modules/react/package.json
public/logo.png
public/favicon.ico
public/images/hero.jpg
public/images/bg.svg
dist/bundle.js
dist/bundle.css

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. 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. 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. 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. 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?
A pattern syntax using wildcards (*, **, ?) to match file paths. Used in .gitignore, tsconfig.json, eslint configs, webpack, Docker, GitHub Actions, and shell commands.
What does ** mean in a glob?
** matches any number of directories, including zero. For example, src/**/*.ts matches TypeScript files at any depth under src/ — including src/utils/helpers.ts.
Why do .gitignore patterns work differently?
.gitignore has special rules: patterns without / match anywhere in the tree, a trailing / matches only directories, and ! negates a previously-matched pattern. This tool supports these semantics.
Can I test multiple patterns at once?
Yes, enter multiple patterns (one per line) to see which patterns match which files. A matrix view shows the relationship between patterns and file paths.
Is this tool free?
Yes, Free to use and privacy-first by design. All pattern matching runs locally in your browser with no server communication.

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

  1. Type the glob pattern. The explanation panel breaks it into tokens (**/, *, literals) and states what each one matches.
  2. Paste your file paths one per line, or click Sample File Tree for a realistic project layout including node_modules and dot files.
  3. Toggle Case Sensitive and Include Dot Files to mirror your build tool's behavior.
  4. Enable Multi-pattern mode to test several patterns at once — including ! exclusions — and read the per-file match matrix.
  5. 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.