UrlMatcher 3.0.0

dotnet add package UrlMatcher --version 3.0.0                
NuGet\Install-Package UrlMatcher -Version 3.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UrlMatcher" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UrlMatcher --version 3.0.0                
#r "nuget: UrlMatcher, 3.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install UrlMatcher as a Cake Addin
#addin nuget:?package=UrlMatcher&version=3.0.0

// Install UrlMatcher as a Cake Tool
#tool nuget:?package=UrlMatcher&version=3.0.0                

alt tag

UrlMatcher

NuGet Version NuGet

Simple URL matcher library allowing you to match based on explicit string or parameters, targeted to .NET Core, .NET Standard, and .NET Framework.

Help or Feedback

First things first - do you need help or have feedback? File an issue here! We'd love to hear from you.

New in v3.0.0

  • Refactor to support both static methods and instances
  • Instances take either a Uri or string (URL)

It's Really Easy... I Mean, REALLY Easy

Refer to the Test project for a working example.

Simple Static Method

Use the static method when you need to compare an input URL against a pattern once.

using UrlMatcher;

string pattern = "/{version}/users/{userId}";
NameValueCollection vals = null;

if (Matcher.Match("/v1.0/users/42", pattern, out vals))
{
  Console.WriteLine("Match!");
  Console.WriteLine("  version : " + vals["version"]);  // v1.0
  Console.WriteLine("  userId  : " + vals["userId"]);   // 42
}
else
{
  Console.WriteLine("No match");
}

Instance Method

Instantiate the class by supplying the URI or URL. Using the instance method eliminates the need to repeatedly parse the input URI or URL.

using UrlMatcher;

Matcher matcher = new Matcher("/v1.0/users/42");
NameValueCollection vals = null;

if (matcher.Match("/{version}/users/{userId}"))          // do something
else if (matcher.Match("/{version}/hobbies/{hobbyId}"))  // do something
else
{
  Console.WriteLine("No match");
}

Version History

Please refer to CHANGELOG.md.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on UrlMatcher:

Package Downloads
HttpServerLite

User-space HTTP and HTTPS server without http.sys written in C#. Please visit the project site README for details on implementation.

Watson.Core

Core library for Watson and Watson.Lite; simple, fast, async C# web servers for handling REST requests with SSL support, targeted to .NET Core, .NET Standard, and .NET Framework.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on UrlMatcher:

Repository Stars
dotnet/WatsonWebserver
Watson is the fastest, easiest way to build scalable RESTful web servers and services in C#.
Version Downloads Last updated
3.0.0 3,452 8/2/2024
2.0.1 42,228 3/13/2023
2.0.0 687 3/13/2023
1.0.0.3 85,425 2/7/2022
1.0.0.2 21,224 11/12/2021
1.0.0.1 80,041 2/22/2021
1.0.0 886 2/22/2021

Refactor to support static and instance methods.