glob Pattern Tester
WebEverything runs locally in your browser — nothing is uploaded
globs (* ? [abc] and the double star) look too simple to get wrong, yet there are three incompatible dialects, and the same pattern can disagree about the same path across shell, .gitignore and .dockerignore. A leading slash is an ordinary character in shell but anchors to the root in the other two. A pattern without a slash matches only the current level in shell, but any level in gitignore (node_modules has to hit packages/app/node_modules, and missing that quietly breaks most .gitignore files). A leading exclamation mark is unrelated to matching in shell, but negates in the other two. So the dialect is an explicit option here, and the pattern is shown translated into a regular expression as well — when you check someone else implementation you are looking at the same thing rather than guessing. The classic mistake is feeding the pattern straight into a RegExp: in glob a dot is a literal character, while in regex it means any character, and a question mark is the other way round. The resulting matcher looks fine and means something else entirely. This tool escapes by glob rules.
Features
- Three dialects handled separately, each with its own meaning for the double star, leading and trailing slashes, and the exclamation prefix
- Every path is reported as matching or not, with matches highlighted
- The pattern is shown as a regular expression so you can check another implementation
- Negated patterns under gitignore or dockerignore are called out (a match there means do not ignore)
- Character classes such as [0-9] and negated ones such as [!0-9] both work; an unclosed bracket is treated as a literal instead of throwing
- Regex metacharacters (dot, plus, parenthesis) are escaped, so *.js does not match aXjs
- A slash followed by a double star matches a itself, and a double star at the front matches a.ts at the root
- Case sensitivity can be turned off
How to use
- Put the pattern on the first line and one path per line below it
- Pick the dialect that matches what you are checking
- Read the per-line verdicts; when one surprises you, look at the regular expression above
- Edit the pattern and the results update as you type
FAQ
- Why does *.js not match src/a.js?
- Because in shell rules an asterisk does not cross a path separator, so *.js matches only .js files in the current directory. Use a double star followed by a slash, or src/*.js, to cross directories. This is easy to confuse with regex: .* in a regex crosses everything by default, while a glob star does not cross a slash — and that is exactly where hand-written translators slip and emit .*.
- Why does a double star at the front match a.ts at the root?
- Because the double star plus slash segment means any number of directories, including none. Someone writing such a pattern wants every .ts file, and a file at the root obviously counts, so that segment has to be allowed to vanish entirely. Many hand-written implementations miss this, and the symptom is that every file under src matches while every file at the root does not.
- What does the exclamation mark mean in .gitignore?
- Negation: it re-includes something an earlier rule ignored. So when a negated rule matches, it means do not ignore this, which is the opposite of every other rule. That is why it is called out separately here. In shell the same character means something else entirely (history expansion) and has nothing to do with matching, so under the shell dialect it is just a literal character.
- Can I validate a whole .gitignore with this?
- One pattern at a time. Put the rule you are unsure about on the first line and list the relevant paths below it. Pasting the whole file does not work, because only the first line is read as the pattern. Picking out the two or three doubtful rules and running them separately is far faster than hunting for why one file is not being ignored.
Related tools
Regex Tester
TextTest a regex in the browser: live highlighting, capture groups, replace preview, a backtracking guard — and JavaScript, Python, Java, Go or PHP code.
.gitignore Generator
WebGenerate a .gitignore from language, framework, editor and OS templates. Sections are merged and duplicates removed. Runs entirely in your browser.
CIDR Calculator
WebTurn 192.168.1.0/24 into a network address, broadcast address, netmask, wildcard mask and usable host range. Runs in your browser.
URL Parser
WebParse a URL into scheme, host, port, path, query parameters and fragment, with each parameter shown raw and decoded. Runs entirely in your browser.
User-Agent Parser
WebParse a user agent into browser, version, OS, device type and engine, and see which rules matched. Pattern matching only. Runs entirely in your browser.
HTTP Status Codes
WebLook up an HTTP status code for its meaning, 1xx–5xx class, typical uses and common traps. Runs entirely in your browser.