Regex, forged in Rust.
Ferroni is a pure-Rust port of the Oniguruma regex engine — the engine behind Ruby, PHP, and TextMate grammars. Full feature parity with the C original, and ahead of Oniguruma across every measured runtime case in the reference suite.
Full compatibility. No compromises.
Ferroni does not wrap Oniguruma. It ports the engine into Rust, keeps the same structure and optimization pipeline, then tunes the runtime path hard.
Built for scanner speed
Tuned for the hot path in syntax highlighters and text scanners: first-match latency and full-line tokenization on real TextMate grammars run far ahead of Oniguruma. The measured factors are below.
Full Oniguruma compatibility
Named captures, variable-length lookbehind, conditionals, absent expressions, 886 Unicode properties, subexpression calls. If it works in Oniguruma, it works in Ferroni.
Pure Rust, no C toolchain
cargo add ferroni and build. Cross-compiles to wasm32-unknown-unknown. No node-gyp, no local C compiler. Only 0.4% unsafe code, all documented.
Built-in multi-pattern scanner
Drop-in compatible with vscode-oniguruma. Regex engine and TextMate grammar scanner in a single dependency. Used by Shiki and VS Code.
Measured, not claimed.
Every number comes from battle_bench, a head-to-head benchmark suite running Ferroni against Oniguruma on the same inputs. No cherry-picked subsets.
Measured on 2026-03-06 with the battle_bench reference suite at commit e8f120aa, on a Mac13,2 (Apple M1 Ultra, 64 GB) running macOS 26.3. Each factor is the ratio of the two timings shown on its card. Full tables, raw values, and the measurement context are in Benchmark Results.
Three lines to your first match
Add Ferroni as a dependency. Write a pattern. Match.
use ferroni::prelude::*; fn main() -> Result<(), RegexError> { let re = Regex::new(r"(?<year>\d{4})-(?\u003cmonth\u003e\d{2})")?; let caps = re.captures("Date: 2026-02-12").unwrap(); assert_eq!(caps.name("year").unwrap().as_str(), "2026"); Ok(()) }
The Oniguruma ecosystem, unlocked
Ferroni works wherever Oniguruma does. These projects all depend on Oniguruma’s feature set — and Ferroni covers it completely.
Start building with Ferroni
Full Oniguruma compatibility with dramatically better performance. One dependency. Pure Rust.