A proof of concept for using Mono/WASM to play with the .NET regular expression engine from within the browser.
Mono is an open-source implementation of the .NET infrastructure.
WASM, or WebAssembly, a runtime to run languages other than JavaScript in the browser.
Thus, Mono/WASM lets you run C# in the browser. (And Blazor builds on that to have an entire C# application framework in the browser.)
This is far along enough that you can use the instructions below to get it working: type in a pattern and a test string, and you get back regex matches according to .NET:
regex101 lets you try regular expressions in the browser, and already supports multiple different engines (and therefore syntaxes). Notably absent is .NET, for lack of JavaScript re-implementation of .NET regular expression behavior.
The long-term goal of this project is to server as a proof of concept that WebAssembly can help fill this gap.
The repository comes with shell scripts derived from the Mono project.
It has only been tested on macOS, but will work largely unchanged on Linux and Windows.
- get the Mono/WASM SDK using these instructions
- clone this repository in a directory right underneath (such that the SDK is
..
) - run the three shell scripts in the filename-suggested
Then, point your browser at http://localhost:8000/sample.html, and try filling the upper two input fields.
You should see a result below, like this:
Regular expression pattern:
^http(s)?://
Test string:
https://example.com
Matches:
Got 1 matches:
https://