v2026.7.19: The Rust drop-in — real-regex now mirrors the regex crate.
The Rust drop-in — real-regex now mirrors the regex crate.
The real-regex crate grows from a thin binding into a drop-in-shaped mirror of the
regex crate, engine unchanged (this is a binding-and-docs release):
- The full query API — find / find_iter / captures / captures_iter / captures_len / capture_names / is_match
/ shortest_match, Match (spans) and indexable Captures (caps[0], caps["name"]), find_at. - replace / replace_all / replacen with the Replacer trait ($-templates, NoExpand, closures), split / splitn,
and RegexBuilder (case-insensitive, multi-line, unicode(false), …). - A bytes:: module mirroring regex::bytes over &[u8] (which need not be valid UTF-8).
- A drop-in mirrors semantics: the empty-match iteration rule is adapted to rust's (an empty match adjacent
to the previous match end is skipped), so find_iter / split / replace_all match the regex crate. - A typed Error (Unsupported vs Syntax) whose hint names the fix, and the opt-in
fallbackfeature: with it,
RegexBuilder::fallback(true) delegates a pattern REAL cannot run linearly (\p{...}, a backreference) to the
regex crate, per pattern, observably via engine() — forfeiting the linear-time guarantee only for those.
Every method is verified against the regex crate by a differential suite, in both feature configurations.
Bounded lookarounds remain REAL's positive divergence — a superset the regex crate and RE2 cannot offer.