# .NET regex engine

This is a fixed `[JSExport]` bridge over .NET 10.0.10
`System.Text.RegularExpressions`, built with SDK 10.0.302 for `browser-wasm`.
It always applies `RegexOptions.CultureInvariant` for deterministic local
results. Native match positions are UTF-16 offsets. The project uses
WebAssembly library mode because its `[JSExport]` methods are hosted directly
inside a module worker and do not require an executable entry point.

The bridge receives one JSON value and never evaluates user input as managed or
JavaScript source. A nine-second native regex timeout complements the app's
shorter killable-worker deadline. Match, capture-row, pattern, subject and
replacement-output limits are enforced in managed code as a second boundary.
Replacement templates are parsed once by a fixed streaming implementation of
.NET's `$$`, numbered/named-group, whole-match, left/right-context, last-group
and whole-input tokens. Engine startup compares that implementation with
native `Match.Result` on a parity corpus. Successful output crosses the JS
export as bounded UTF-8 bytes in canonical base64, avoiding unbounded
intermediate replacement strings and JSON escaping amplification.

Build from the pinned SDK plus `wasm-tools` workload:

```sh
/absolute/path/to/dotnet publish engines/dotnet/RegexTools.DotNet.csproj \
  --configuration Release
```
