regress
A backtracking regular expression engine for Rust that targets ECMAScript regexp syntax
Repository Health
Technical Analysis
regress is a Rust regular expression engine that implements ECMAScript (JavaScript) regexp semantics rather than the more restrictive syntax of Rust’s regex crate. It supports backreferences, lookaround assertions (including variable-width lookbehind with capture groups), and both PikeVM and classical-backtracking execution backends, making it a close match for tools that need to replicate exact JavaScript regex behavior — including UTF-16 surrogate-pair handling controlled by the ‘u’/‘v’ flags — in a Rust codebase.
What You Get
- Full ECMAScript 2018+ regexp syntax support, including backreferences and variable-width lookbehind assertions with capture groups
- Two selectable execution backends: a classical backtracking matcher and a PikeVM implementation (enabled via the
backend-pikevmfeature, on by default) - Accurate UTF-16/surrogate-pair matching semantics matching JavaScript’s ‘u’ and ‘v’ flag behavior
no_std+allocsupport via theallocfeature for embedded or constrained environments- A large test suite including a dedicated PCRE test corpus (
tests/pcre_tests.rs) alongside syntax-error, escape, and replacement test suites
Common Use Cases
- Implementing JavaScript-compatible regex behavior inside a Rust-based JS engine, linter, or transpiler (e.g. matching engine behavior in tools like SWC or Deno-adjacent tooling)
- Validating or replaying user-supplied JavaScript regexes in a Rust backend without embedding a JS runtime
- Porting JavaScript-derived business logic (validation rules, string parsing) to Rust while preserving exact regex-match behavior
- Building developer tools that need to explain or debug JavaScript regex matches (e.g. regex playgrounds, static analyzers) from a Rust codebase
Under The Hood
Architecture: the crate is organized around a classic regex-engine pipeline — parse.rs builds an AST/IR (ir.rs) from ECMAScript regexp syntax, optimizer.rs rewrites it, emit.rs compiles it to bytecode (insn.rs), and execution is handled by either classicalbacktrack.rs or pikevm.rs depending on the selected backend, with unicode.rs/unicodetables.rs/charclasses.rs providing Unicode-aware character class support and cursor.rs/indexing.rs abstracting over UTF-8/UTF-16 position handling. Tech Stack: Rust (2024 edition) organized as a Cargo workspace with regress-tool (a CLI/debug tool) and gen-unicode (Unicode table generation) as workspace members alongside the core crate; runtime dependencies are minimal (memchr, optional hashbrown for no_std+alloc), keeping the dependency footprint small relative to its syntax coverage. Code Quality: the tests/ directory includes dedicated suites for syntax errors, escape sequences, replacements, general patterns, and a PCRE-derived compatibility corpus (pcre_tests.rs), giving unusually broad regression coverage for a regex engine; the codebase is actively maintained with ~11 commits/month and 13 tagged releases. API Design: the public regress::Regex type mirrors familiar regex-crate ergonomics (Regex::new(pattern), .find(), .find_iter()) while accepting JavaScript-flavored flags directly, so developers coming from either Rust’s regex crate or JavaScript’s RegExp can adopt it with only small adjustments for flag semantics.
Used by 3 apps in this directory
Anarlog
Note Taking · AI Assistants · Productivity
Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.
Arroyo
Data Engineering · Analytics
A distributed stream processing engine written in Rust that lets you write SQL to run stateful, real-time computations over data streams with subsecond results.
fabro
Developer Tools · Devops
Define AI agent workflows as code graphs, route tasks across any LLM, and intervene only where it matters.