Write a readable Melody pattern that matches version strings like 1.2.3 and compile it to a regex for use in JavaScript code.
Replace a hard-to-read existing regex in a codebase with Melody syntax that teammates can understand without regex expertise.
Use the Melody REPL to iteratively build and test a text-matching pattern without switching between tools.
Generate named capture groups from human-readable syntax to extract structured data like dates or email parts from text.
Melody is a small programming language that compiles into regular expressions. Regular expressions are patterns used to search for or validate text, but their syntax is famously hard to read. A pattern like ^v?(\d+)\.(\d+)\.(\d+)$ is difficult to understand at a glance. Melody lets you write the same pattern in plain words and then outputs the equivalent regular expression automatically. The syntax uses English-style keywords. To match one or more digits you write some of <digit>. To match exactly 16 repetitions of the text "na" you write 16 of "na". Named groups called captures let you label parts of a pattern: capture major { some of <digit>, } becomes a named capturing group in the output. The language supports all the usual regular expression concepts including optional parts, lazy matching, character classes, anchors for start and end of a string, and lookaheads. Each feature maps directly to a well-known regex construct. Melody targets ECMAScript regular expressions, which are the kind used in JavaScript and many other environments. The compiler is written in Rust. You can run it as a command-line tool, use an interactive REPL that compiles each line as you type, or try it in a browser-based playground without installing anything. Installation is available through Cargo (the Rust package manager), Homebrew on macOS and Linux, the Arch User Repository, and NixOS. Pre-built binaries for macOS are on the releases page. The project has a book with full documentation at a separate site. The repository is actively maintained with a public changelog. It was built to make regular expressions more approachable by letting developers write patterns that read almost like a description of what they want to match.
← yoav-lavi on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.