feat: add multi-engine regex flavour support

This commit is contained in:
2026-07-27 11:43:51 +02:00
parent 7079cde15f
commit 7f3a91ad37
340 changed files with 643286 additions and 483 deletions

26
engines/dotnet/README.md Normal file
View File

@@ -0,0 +1,26 @@
# .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
```