DevTools Logo

Glob Pattern Tester

Glob Pattern Tester

Test glob patterns against a file list and see exactly why each path matches or misses.

Runs in your browser
Try an example

Patterns and file list

Pattern cheatsheet
*
Any characters within one path segment (not “/”)…
**
Any number of path segments, including none.
?
Exactly one character within a segment.
[abc]
One character from the set; [!abc] excludes.
{a,b}
Either alternative (brace expansion).
!pattern
Negates an earlier match (gitignore-style ordering).
foo/
gitignore: matches directories named foo only.

Match results

Enter patterns and a file list to see which paths match

Results update as you type. Nothing leaves your browser.

Details

Glob behavior differs subtly between tools: does * match .env? How far does ** reach? What happens when a negation rule follows an exclusion? This tester runs your patterns over a pasted file list (or a folder you pick) and shows every path with a matched or not-matched badge, plus the ordered rule trail that produced the verdict. Pick a dialect to match your target tool: minimatch as used by npm and bundlers, bash with dotglob control, or gitignore-style rules with anchoring, dir-only patterns and last-rule-wins negation. Click any path for a segment-by-segment explanation of the decisive pattern, including how many segments ** consumed. Everything runs locally — your file lists never leave the browser.

More examples

Find every TypeScript source

Pattern: src/**/*.ts
List: src/index.ts, src/lib/parse.ts, public/logo.svg

** spans any number of folders, so both src files match while the SVG does not.

gitignore-style negation

build/
*.log
!logs/.gitkeep

Trailing slash makes build/ dir-only; the ! rule re-includes one file and the trail shows the last matching rule wins.

Why * skips dotfiles

Pattern: *.env   List: .env, app.env

Wildcard patterns do not match dot-leading names unless dot matching is on — the explain view says exactly that.

    Examples

    TypeScript sources under src

    Input
    src/**/*.ts
    src/index.ts
    README.md
    Output
    Matched: src/index.ts — Unmatched: README.md

    With globstar enabled, ** spans zero or more directories; the trailing .ts limits the match to TypeScript files.

    Why .env is skipped

    Input
    *
    .env
    .env.local
    Output
    Dot mode off: .env unmatched · Dot mode on: matched

    Most glob engines exclude leading dots from wildcard matches; toggle dot mode to see the difference immediately.

    Negation in rule order

    Input
    dist/**
    !dist/keep.txt
    Output
    dist/main.js matched · dist/keep.txt not matched

    In gitignore semantics the later negation rule wins for the specific file, while the broad rule still covers everything else in dist.

    About this tool

    The Glob Pattern Tester evaluates patterns against a file list you supply and shows exactly which paths matched, which did not, and why. Choose between minimatch, bash and gitignore-style semantics, toggle dot-file matching, case sensitivity and globstar depth, then click any path to walk through the segment-by-segment match trace. Nothing is read from your disk unless you explicitly pick a folder.

    Negation is evaluated in rule order: a later `!pattern` flips a path's verdict in the gitignore dialect, while minimatch chains treat each line independently. The result list carries a per-path rule trail, so competing rules stop being a mystery — you can see which rule last touched a path and whether it matched.

    The tool is deliberately a glob debugger, not a regex tester and not a filesystem browser. Patterns stay in the tab; the file list is a textarea or a folder picker, and exports are plain CSV. Large lists are capped at 20,000 paths and 200 rules so a pasted monorepo tree never freezes the browser.

    What this tool does not do

    • The tool evaluates text patterns only — it never walks your filesystem unless you choose files with the folder picker.
    • Dialects approximate their engines; shell-specific extglob forms and exotic minimatch switches may not be supported.
    • Very large inputs are capped at 20,000 paths and 200 rules to keep the browser responsive.

    How to use this tool

    1. Paste your patterns

      Enter one glob per line in the patterns box. A leading ! negates a match in gitignore mode; order matters because later rules decide the final verdict.

    2. Add paths to test

      Paste a file tree, one path per line, or use the folder picker. Toggle dot files, case sensitivity and globstar to match your tool's semantics.

    3. Inspect the verdict trail

      Matched and unmatched lists carry badges and a per-rule trail. Click a path to open the explain view and see which segment of which pattern consumed it.

    4. Export or share

      Copy the verdicts as CSV for a bug report, or use the share control to encode a small pattern/list pair into the URL.

    Use cases

    Debug .gitignore rules

    Paste a ignore rule set with a sample path list and see which rules win, including anchoring and negation, before committing the change.

    CI path filters

    Validate that a workflow's include/exclude globs actually catch the changed files you expect.

    Dockerignore and bundler globs

    Compare the same pattern under different dialects to catch subtle leading-dot and ** depth differences.

    Teach glob syntax

    Use the segment trace to show a learner exactly which part of a pattern failed for a given path.

    Supported glob syntax by dialect

    SyntaxBehavior
    *Matches within one path segment, never a slash
    **Spans any number of segments when globstar is on
    ?Exactly one character (except a slash)
    [abc] / [!abc]Character class / negated class
    {a,b}Brace alternatives in minimatch and bash
    !patternNegation — gitignore rules are applied in order
    /patternAnchored at the root in gitignore mode
    pattern/Directory-only rule in gitignore mode

    Leading dots never match * or ? unless dot mode is enabled — that is why .env escapes a src/* rule in most tools.

    Common mistakes

    Mistake:Assuming * matches slashes.

    Fix:* only matches inside one segment. Use ** for nested paths, or **/ to match at any depth.

    Mistake:Wondering why dotfiles are skipped.

    Fix:Wildcards do not match a leading dot by default. Turn on dot mode, or write the dotfile name explicitly.

    Mistake:Using ! negation with minimatch semantics and expecting gitignore ordering.

    Fix:Negation and last-rule-wins are gitignore semantics. Switch the dialect selector to gitignore when testing ignore files.

    Mistake:Adding a leading slash to match repository-root files in every dialect.

    Fix:Anchoring is dialect-specific: in gitignore a leading / pins the path to the file's directory; minimatch treats it as part of the pattern.

    Frequently asked questions

    Why doesn't * match dotfiles?

    Most glob engines deliberately exclude names starting with a dot from wildcard matches, so `*` skips .env and `.*` must be written explicitly (or dotglob/dot mode enabled). The tester has a dot-file toggle precisely so you can see why a path was skipped instead of guessing. With dot mode on, * and ? can match a leading dot.

    What's the difference between * and **?

    * matches zero or more characters within a single path segment; it never crosses a slash. ** (globstar) spans any number of segments when the dialect supports it. `src/*.ts` matches only files directly inside src, while `src/**/*.ts` also matches src/deep/nested/file.ts. In bash, globstar must be enabled explicitly; the dialect toggle models that difference.

    How do negation patterns apply?

    In gitignore-style semantics rules are evaluated in order and the last matching rule decides the verdict: `dist/**` followed by `!dist/keep.txt` excludes everything in dist except that one file. In minimatch chains, negation is a property of an individual pattern rather than a stateful override. The per-path rule trail shows each rule's contribution so you can tell which model your config uses.

    Do globs work the same in gitignore and minimatch?

    No. gitignore treats a leading slash as anchored to the ignore file's directory, a trailing slash as directory-only, and supports ordered negation; minimatch has brace expansion and switches like dot/nocase without that ordering model. That is why the tester offers a dialect selector — the same text can produce different verdicts, and the explain view highlights where.

    How do I match files only at the root?

    In gitignore mode, write `/file.txt` — the leading slash anchors the rule to the directory containing the ignore file. Without it, a pattern with no interior slash matches at any depth. In minimatch, use an explicit path without ** and avoid a recursive prefix. The anchoring warning in the rule list tells you when a leading slash is being interpreted as a root anchor.

    Does this tool read my computer's files?

    No. Patterns and paths are text you paste or pick with the optional folder input; nothing is uploaded and no server is involved. The CSV export and URL share encode only what you typed.

    References & standards