Glob Tester
Test glob patterns against a list of file paths in real-time.
🔒 Client · Offlinesrc/index.ts
Rule 1: src/**/*.ts
src/utils/math.ts
Rule 1: src/**/*.ts
src/utils/math.test.ts
Rule 3: !src/**/*.test.ts
src/components/Header.vue
Rule 2: src/**/*.vue
tests/unit/app.test.ts
No rule matched
dist/bundle.js
No rule matched
logs/debug.log
No rule matched
package.json
No rule matched
docs/README.md
No rule matched
About glob patterns
A glob pattern selects files by name. This tool tests an ordered list of patterns against a list of paths. Each result row shows the rule that decided the result, so you can correct a rule before you use it.
Pattern syntax
*matches any characters in one folder segment.**matches across folders at any depth.?matches one character.{a,b}matches any of the comma-separated options.[a-z]matches one character in the range.[!a-z]matches one character outside the range.!patternexcludes a path.
Rule order
The tool reads the patterns from the top down and keeps your order. The last pattern that matches decides the result. A path that no pattern matches is excluded. The tool does not move an exclude rule ahead of an include rule, so a ! rule on the first line has no effect on a path that a later rule includes.
Flavor differences
| Flavor | Rules |
|---|---|
| Standard glob | The pattern must match the full path. * and ? stop at a folder separator. ** crosses folders. {a,b} and +(a|b) expand. A pattern must start with a dot to match a dot file. |
| .gitignore | A pattern with no slash matches at any depth. A leading / anchors the pattern to the root. A trailing / matches a directory only. A rule on a folder also selects the content of the folder. A line that starts with # is a comment. Git expands no braces and no extglobs, so {a,b} is literal text. A dot file is a normal name. |
| minimatch | The same syntax as the standard flavor. minimatch is the matcher in ESLint, npm, and Prettier. It reads the same patterns as picomatch, the engine of this tool. |
Limits
- The tool has no filesystem. It reads your paths as text. A path that ends with
/is a directory. For any other path the tool cannot know the type, so a directory-only rule such asbuild/does not match it. - The tool tests one list of rules. It does not read a nested
.gitignorefile and it applies no file precedence. The result is close to git, but it is not full.gitignoreparity. - The engine is picomatch with the POSIX separator. Another operating system, shell, or library can give a different result for the same pattern.
- The minimatch flavor uses the same engine. Two differences are known: this tool matches the bare folder
aagainsta/**and minimatch does not. This tool matchesa//bagainsta/*/band minimatch does not.