Part of [Ferramenta](https://ferramenta.dev), a family of Rust tools.
# Ferroni — Oniguruma regex in pure Rust
[](https://oss.sebastian-software.com) [](https://crates.io/crates/ferroni)
[](https://docs.rs/ferroni)
[](https://github.com/sebastian-software/ferroni/actions)
[](https://github.com/sebastian-software/ferroni/blob/main/.github/workflows/ci.yml)
[](CONTRIBUTING.md#getting-started)
[](https://github.com/sebastian-software/ferroni/blob/main/LICENSE)
**Oniguruma-compatible regex engine.**
Ferroni runs Oniguruma's full syntax in Rust, including look-behind,
backreferences and recursion, and ships the scanner that TextMate syntax
highlighters drive. Cargo builds it like any other crate, WebAssembly
included, with no C compiler and no bindgen.
## Why Ferroni
**Oniguruma ended; the engine goes on.** Oniguruma matches the patterns in
every TextMate grammar, in PHP's mbstring and in jq. Its C project closed in
April 2025. Ferroni continues the engine in memory-safe Rust, ported function
by function, and [passes all 2,974 UTF-8 tests](https://ferroni.dev/guide/compatibility)
of the C original.
**Only a JIT is faster.** Once a pattern is compiled, Ferroni matches
2.7–3.4× faster than C Oniguruma, and it generates no machine code at runtime.
Of the engines measured on regex tasks from Django, Rails, WordPress and other
projects, only PCRE2's JIT is faster. C still compiles patterns faster, so a
pattern used once favors C. The
[benchmark summary](https://ferroni.dev/perf/regex-workloads) gives the method;
the [full results](benches/production_results/README.md) are in the repository.
**It runs the patterns `regex` rejects.** Rust's [`regex`](https://crates.io/crates/regex)
crate leaves out look-around and backreferences to guarantee linear time.
Ferroni runs them as Oniguruma does, in all twelve of its syntax modes, and is
the only Rust engine with every feature in the
[feature matrix](https://ferroni.dev/perf/regex-workloads). For untrusted
patterns, that linear-time guarantee keeps `regex` the safer choice.
**The scanner highlighters expect, in safe Rust.** VS Code and Shiki highlight
code with TextMate grammars written for Oniguruma. Ferroni's Scanner keeps
vscode-oniguruma's API, UTF-16 offsets included, and
[Ferriki](https://ferriki.dev) runs on it. C Oniguruma fixed five memory-safety
CVEs in 2019; Ferroni's engine is safe Rust, with
[10 unsafe sites](https://ferroni.dev/adr/002-unsafe-code-policy) left, all
linking parse-tree nodes, none in buffer or string code.
**[Explore Ferroni →](https://ferroni.dev)** — examples, compatibility
evidence, benchmarks and a Scanner walkthrough.
## Quick start
```bash
cargo add ferroni
```
```rust
use ferroni::prelude::*;
fn main() -> Result<(), RegexError> {
// A look-behind and named groups: Oniguruma syntax, a familiar API.
let re = Regex::new(r"(?<=Date: )(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})")?;
let caps = re.captures("Date: 2026-02-12").unwrap();
assert_eq!(caps.get(0).unwrap().as_str(), "2026-02-12");
assert_eq!(caps.name("year").unwrap().as_str(), "2026");
Ok(())
}
```
## Scope
Ferroni covers ASCII and UTF-8, two of Oniguruma's 29 encodings, and leaves
out the POSIX and GNU APIs. It backtracks like C Oniguruma, so give searches
over untrusted input a time or retry limit. On `wasm32-unknown-unknown`, the
browser target, use a retry limit; that target has no clock for a time limit.
See [compatibility](https://ferroni.dev/guide/compatibility) and
[untrusted input](https://ferroni.dev/guide/untrusted-input).
## Documentation
- [Getting started](https://ferroni.dev/guide/getting-started) — captures, iteration, options, errors and the Scanner API.
- [API reference](https://docs.rs/ferroni) — every public type and function.
- [Regex benchmarks](https://ferroni.dev/perf/regex-workloads) — the speed summary, source projects, method and feature matrix.
- [Benchmark results](benches/production_results/README.md) — per-platform aggregates, with every case and timing in [`publication.json`](benches/production_results/publication.json) and tiktoken pre-tokenization in [`additional_results`](benches/additional_results/README.md).
- [Migrating to 2.0](https://ferroni.dev/guide/migrating-to-2) — breaking changes with before and after code.
## Project status and contributing
Ferroni is feature-complete and maintained. No feature work is planned; bug
fixes, Unicode updates, toolchain upkeep and security fixes continue. See the
[project status](https://ferroni.dev/#project-status) for the maintenance
scope.
[CONTRIBUTING.md](CONTRIBUTING.md) covers builds, tests and benchmarks; pull
requests keep the
[structural parity with C Oniguruma](https://ferroni.dev/adr/001-one-to-one-parity-with-c-original)
that the port is built on. Report vulnerabilities privately as described in
[SECURITY.md](SECURITY.md).
## Acknowledgments and license
Built on [K. Kosako's Oniguruma](https://github.com/kkos/oniguruma) and
Microsoft's [vscode-oniguruma](https://github.com/microsoft/vscode-oniguruma)
Scanner API and tests. Ferroni is an independent continuation and is not
affiliated with or endorsed by Oniguruma's original author.
[BSD-2-Clause](LICENSE), inherited from the Oniguruma source this port is
based on.
### <a href="https://ferramenta.dev"><img src="https://raw.githubusercontent.com/sebastian-software/ferramenta/main/app/assets/brand/logo-light.svg" width="24" height="24" alt="" /> More from Ferramenta</a>
[Ferramenta](https://ferramenta.dev) — A family of Rust tools.
**Engines**
| [ferriki](https://ferriki.dev) | Shiki-compatible syntax highlighting |
| [ferromark](https://ferromark.dev) | Markdown to HTML, sanitized by default |
| [ferrolex](https://github.com/sebastian-software/ferrolex) | Spell checking for text and code |
| [ferrocat](https://ferrocat.dev) | Translation catalog engine |
| [ferralk](https://github.com/sebastian-software/ferralk) | Glob matching and parallel filesystem walking |
| [ferrugo](https://github.com/sebastian-software/ferrugo) | PDF previews for untrusted files |
**Applications**
| [palamedes](https://palamedes.dev) | Internationalization for TypeScript applications |
| [dalo](https://dalo.sh) | Your team's agent setup, versioned like code |
---
<p align="center">
<a href="https://oss.sebastian-software.com"><img src="https://raw.githubusercontent.com/sebastian-software/oss.sebastian-software.com/main/app/assets/logo-software.svg" alt="Sebastian Software" width="160" /></a><br />
TypeScript, React & Rust consulting<br />
Experts in Agentic Software Development<br />
<a href="https://sebastian-software.de">Work with us</a> · <a href="https://oss.sebastian-software.com">More open source</a>
</p>
<p align="center">Copyright © 2026 Sebastian Software GmbH</p>