Label Filter

Label Filter is a small pattern language for filtering lists of objects by their labels: files, tags, titles, anything with a name.

View Label Filter Documentation at Label Filter Docs

Benefits

  • The search people actually run costs no syntax at all: a plain word is a case-insensitive contains.
  • Learnable in a minute: six reserved characters, no lookahead, no capture groups, no flags.
  • Typeable with one hand: anchors, wildcards and sets are one character each.
  • Five implementations, one language. TypeScript, Rust, Python, Go and PHP, every one of them held to a single shared conformance fixture, so a pattern means the same thing in the browser, the service and the script, and a port cannot drift quietly.
  • A pattern it cannot read hides nothing: it matches everything and says why, instead of returning a confident empty list.
  • No runtime dependencies in any implementation, and none in their test runners either.

How It Works

A pattern is parsed into a small intermediate form and walked, never compiled to a regular expression. That keeps the public language small and deterministic, and stops a regex engine's implementation details leaking into what a pattern means. In the Python and PHP implementations, where a regex engine is in the standard library, that is the most load-bearing line in the file.

Wildcards, anchors, character sets, alternation, grouping, case control, whole-word matching and exclusion cover the large majority of list filtering between them. What the language deliberately does not have matters as much as what it does: no quantifiers, no lookahead, no capture, no backreferences.

The specification is executable. 73 cases lifted from its numbered sections, 31 patterns that must be refused, and 43 fragments of junk that must not crash anything, 399 assertions in one file that every implementation runs. A translation is either conformant or it fails, and the reference implementation carries two further suites: one that walks every pattern up to a given length and checks generated patterns against an independently written oracle, and one whose ceiling is a single keystroke over a whole list.

Try It Today

Label Filter is being prepared for release. Nothing is published to a package registry yet, deliberately: the first publish is what fixes a package’s identity, and that is a decision worth making on purpose.