Free tool · Developer tools
Glob pattern tester
A glob pattern tester checks a wildcard pattern against a list of file paths and marks each as a match or not. The pattern src/**/*.{ts,tsx} matches 3 of the 8 example paths.
- Free
- No sign-up
- Runs in your browser
3 of 8paths match
- 2 patterns after braces
- Patterns checked
- src/**/*.ts src/**/*.tsx
| Path | Result |
|---|---|
| src/index.ts | Match |
| src/components/Button.tsx | Match |
| src/components/Button.test.ts | Match |
| src/utils/.hidden/helper.ts | No match |
| src/styles/main.css | No match |
| src/App.TSX | No match |
| README.md | No match |
| lib/index.ts | No match |
How to use the Glob Pattern Tester
- Type a pattern in Glob pattern, for example
*.jsordocs/**. - List the paths you want to check in Paths to test, one per line.
- Turn on Match dot files or Ignore case if your tool does.
- Read the count at the top and the Match or No match mark beside each path.
How does glob pattern matching work?
A glob is a short wildcard pattern for file names. The question mark matches one character, the star matches any run of characters, and square brackets match one character from a set, such as [ab] or the range [a-c]. A leading exclamation mark inside the brackets turns the set around, so [!a] matches any character except a. A backslash makes the next character literal. These rules come from the POSIX pattern matching notation. One more rule matters for paths: a slash in a path can only be matched by a slash in the pattern, so a single star never reaches into a folder.
Two common extensions sit on top of that. A double star used as a whole path segment matches any number of folders, including none. Braces list alternatives, so *.{js,md} stands for the two patterns *.js and *.md, and a number range such as {1..3} stands for 1, 2 and 3. A leading zero on either end pads the numbers, so {01..03} gives 01, 02 and 03. Ranges must use whole numbers no larger than 9,007,199,254,740,991 and may expand to fewer than 500 items. The question mark matches one character, so an emoji counts as one. The page expands braces first, then checks each result.
The table runs nine patterns against one fixed list of nine paths: index.js, app.js, app.test.js, lib/util.js, lib/deep/util.js, .eslintrc.js, docs/a1.md, docs/a2.md, docs/b.md.
| Pattern | Matches | Which paths |
|---|---|---|
| *.js | 3 | index.js, app.js, app.test.js |
| **/*.js | 5 | index.js, app.js, app.test.js, lib/util.js, lib/deep/util.js |
| lib/*.js | 1 | lib/util.js |
| lib/** | 2 | lib/util.js, lib/deep/util.js |
| *.{js,md} | 3 | index.js, app.js, app.test.js |
| docs/a?.md | 2 | docs/a1.md, docs/a2.md |
| docs/[ab]*.md | 3 | docs/a1.md, docs/a2.md, docs/b.md |
| docs/[!a]*.md | 1 | docs/b.md |
| *.test.js | 1 | app.test.js |
What does src/**/*.{ts,tsx} match?
The braces expand to 2 patterns: src/**/*.ts and src/**/*.tsx. A path matches when it fits either one. Of the 8 example paths, 3 fit: src/index.ts, src/components/Button.tsx, src/components/Button.test.ts. The double star lets src/index.ts match with no folder between, and src/components/Button.tsx with one folder.
Five paths do not fit, for four different reasons. src/styles/main.css has the wrong extension. README.md and lib/index.ts are outside src. src/App.TSX has the right letters in the wrong case, and src/utils/.hidden/helper.ts sits under a folder whose name starts with a dot. Turning on Ignore case brings the total to 4, and turning on Match dot files brings it to 4.
Compare the star and the double star on the nine reference paths. The pattern *.js matches 3, because it stays in the top folder. The pattern **/*.js matches 5, because it also reaches lib/util.js and lib/deep/util.js. The pattern lib/** matches 2, everything below lib.
Why are dot files left out?
POSIX filename expansion says a name that begins with a period must be matched by an explicit period at the start of the pattern or right after a slash. A star, a question mark or a negated bracket cannot match that first period. That is why the pattern * does not list .env and why **/*.js skips .eslintrc.js in the reference list. To reach a hidden name, start the pattern segment with a literal dot, as in .*, or switch on Match dot files. Many tools expose the same choice under a name such as dot or dotglob.
The page applies the rule to every segment, so a hidden folder in the middle of a path blocks a wildcard just as a hidden file name does.
How is this different from a regular expression?
A glob describes whole path names with a few wildcards, while a regular expression describes text with many more operators. In a glob the dot is an ordinary character, the star cannot cross a slash and the pattern must fit the entire path, not just part of it. Behind the scenes the page splits your glob into folder level pieces for each brace result and matches every line against them with its own wildcard matcher, so a pattern with many stars cannot stall the tab.
Tools differ in small ways, such as how they treat a trailing slash or a negating exclamation mark at the start of a pattern. This page tests the rules listed above and does not read ignore files, so confirm edge cases against the tool you use.
Use it with
- Remove Duplicate Lines: clean lists of repeated lines.
- Text Compare: show differences between two texts.
- Sort Lines Alphabetically: sort lists A–Z, Z–A, by length.
Questions
What does ** mean in a glob?
As a whole segment it matches any number of folders, including none. With 9 reference paths, **/*.js matches 5 files and *.js matches 3.
Why does * not match a slash?
In pathname matching a slash must be matched by a slash in the pattern. Use ** to cross folders.
Why is my dot file not matched?
A name that starts with a period needs a literal period in the pattern, or the Match dot files option. Wildcards skip it on purpose.
How do I match two extensions?
Use braces, as in *.{js,md}. The page expands them into separate patterns, shown under the result. src/**/*.{ts,tsx} expands into 2.
Is glob matching case sensitive?
Here it is by default. src/App.TSX does not match src/**/*.{ts,tsx} until you turn on Ignore case, which raises the match count from 3 to 4.
Are my paths uploaded anywhere?
No. Matching runs in your own browser, and the paths you list are never sent over the network.
The tool's results are computed in your browser by the code on this page, using the sources listed above; the explanations are checked against the tool's own output.