top | item 47153856

Show HN: Match – A pattern matching language that replaces regex

3 points| hollowsolve | 6 days ago |matchlang.com

I built Match, a pattern matching language designed to replace regex. Instead of cryptic escape sequences, you describe patterns in plain English.

Example — matching an email address:

email: username then "@" then domain

username: one or more of (letter, digit, ".", "_", "-")

domain: one or more of (letter, digit, "-") then "." then between 2 and 6 letters

Key differences from regex:

- Human-readable grammar syntax - Full parse trees with named extractions - No backtracking, no ReDoS by design - Composable grammar modules (use "module" (rule1, rule2)) - Zero dependencies, ~15KB

Available on npm (@hollowsolve/match). Docs, playground, and examples on the site.

GitHub: https://github.com/hollowsolve/Match

discuss

order