Glob Filter — Terminal

Write glob patterns that pick the right files and reject the rest: 18 levels of wildcards, * and **, character classes and brace expansion.

What you learn in this game

A glob is a pattern that picks files by their path. Terminals, .gitignore, vite.config, ESLint and nearly every JavaScript tool use them. * matches any run of characters except a slash /, so * stays inside one folder. In this world every folder is one cloth wrapped round a bundle: * only takes the bundles with no wrapping.

Curly braces {a,b,c} mean one of this list. An extension, a folder name, or a piece of a name. Each choice is written out whole, separated by commas, with no spaces.

` (two stars) standing on its own between slashes is called a globstar: it matches any number of folders, including none. / at the start means "in any folder". A single star *` still stays in one folder.

Square brackets [...] make a character class: it matches exactly one character from the set inside. Write it one by one ([123]) or as a range ([1-3], [a-z], [A-Z]).

An exclamation mark ! (or a caret ^) at the start of a class turns it round: [!_] matches any one character except the underscore. Files starting with _ often mark "private" files that must not be built.

What the levels ask

  1. Tap pieces of glob. * fills in any name, but it stops at a slash /.
  2. Braces {js,ts} match one of the choices inside them.
  3. ? matches exactly one character, not zero and not two.
  4. `` between slashes matches zero or more folders.
  5. The folder name, a slash, then * for one level.
  6. The class [123] matches one character from that set. The range [1-3] means the same.
  7. Put / together with the right ending of the name.
  8. `` at the end of a pattern takes everything below that folder.
  9. Braces can hold more than two choices.
  10. [!_] matches any one character except _. [^_] means the same.
  11. Put together /, the fixed name and braces for the extension.
  12. A fixed folder in front, `` in the middle, the ending at the back.

And more, 18 levels in all.