This package implements the URLPattern
web API in C#. We aim to follow the specification as closely as possible.
using URLPatternWebApi;
// Create the URLPattern to match against.
var init = new URLPatternInit {
Pathname = "/users/:id"
};
var pattern = new URLPattern(init);
// Match the pattern against a URL.
var url = "https://example.com/users/123";
var result = pattern.Exec(url);
Assert.Equal("123", result.Pathname.Groups["id"]);
To execute the tests, run:
cd ./test
dotnet watch test