Files
regex-tools/engines/rust/README.md

26 lines
1.3 KiB
Markdown

# Rust regex WebAssembly engine
This directory builds the actual Rust `regex` crate 1.13.1 for
`wasm32-unknown-unknown` with Rust 1.97.1 and wasm-bindgen 0.2.126.
The fixed bridge accepts JSON values only. The adapter measures the exact
encoded request size, and the native cap includes JSON's worst-case sixfold
escaping for every accepted string field. It exposes native UTF-8 byte offsets,
capture names, iteration, and `Captures::expand` replacement syntax. It does
not evaluate user values as Rust or JavaScript source.
Replacement uses a bounded streaming implementation of
`Captures::expand` grammar. Load-time differential fixtures compare it with
the native API, and capture references stop expanding as soon as the UTF-8
output cap is reached.
The bounded bytes cross the JSON bridge as base64, so control-heavy output has
a fixed 4:3 transport expansion instead of JSON's content-dependent escaping.
Flags `i`, `m`, `s`, `U`, `x`, and `R` map directly to `RegexBuilder`.
Unicode is the crate's native default; the accepted `u` flag explicitly
affirms that default. `g` selects the crate's native iterator.
The crate deliberately excludes look-around and backreferences. Compile-size,
DFA-cache, pattern, subject, match, capture-row, and output limits are enforced
inside the module. Replacement output is clipped only at a UTF-8 boundary.