Cloudtoid.UrlPattern 1.0.35

dotnet add package Cloudtoid.UrlPattern --version 1.0.35
                    
NuGet\Install-Package Cloudtoid.UrlPattern -Version 1.0.35
                    
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="Cloudtoid.UrlPattern" Version="1.0.35" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cloudtoid.UrlPattern" Version="1.0.35" />
                    
Directory.Packages.props
<PackageReference Include="Cloudtoid.UrlPattern" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cloudtoid.UrlPattern --version 1.0.35
                    
#r "nuget: Cloudtoid.UrlPattern, 1.0.35"
                    
#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.
#:package Cloudtoid.UrlPattern@1.0.35
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cloudtoid.UrlPattern&version=1.0.35
                    
Install as a Cake Addin
#tool nuget:?package=Cloudtoid.UrlPattern&version=1.0.35
                    
Install as a Cake Tool

Cloudtoid.UrlPattern

Match URL paths and extract named values with readable patterns. Supports prefix and exact matching, optional sections, wildcards, and regular expressions. Compiled patterns are cached for reuse.

Install

Requires .NET 10 or later.

dotnet add package Cloudtoid.UrlPattern

Example

using Cloudtoid.UrlPattern;

var engine = new PatternEngine();
var match = engine.Match(
    pattern: "exact: /category/:category/product/:product",
    path: "/category/furniture/product/black-couch");

Console.WriteLine(match.Variables["category"]); // furniture
Console.WriteLine(match.Variables["product"]);  // black-couch

Pass the URL path only, starting with /; exclude the scheme, host, query string, and fragment. Match throws when matching fails; use TryMatch to handle a non-match without an exception.

Pattern syntax

  • :name captures a named value.
  • * matches characters within a path segment, excluding /.
  • Parentheses mark optional sections, such as /products(/:id).
  • exact: requires the entire path to match.
  • prefix: matches a prefix and is the default mode.
  • regex: enables regular expressions with named captures.

For dependency injection, call services.AddUrlPattern() and inject IPatternEngine.

Full syntax and examples · Report an issue · MIT license

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.35 84 9/12/2026
1.0.34 82 9/12/2026
1.0.33 36,769 2/8/2023
1.0.32 903 11/20/2022
1.0.31 520 11/20/2022
1.0.30 614 7/11/2021
1.0.29 532 6/17/2021
1.0.28 640 8/26/2020
1.0.27 694 8/26/2020
1.0.26 676 8/17/2020
1.0.25 28,762 5/13/2020
1.0.24 723 5/12/2020
1.0.23 739 4/13/2020
1.0.22 709 4/7/2020
1.0.21 734 4/7/2020
1.0.20 748 4/7/2020
1.0.19 790 4/6/2020
1.0.18 742 4/6/2020
1.0.17 732 4/6/2020
1.0.16 769 4/6/2020
Loading failed