Dissect.Extended.Net 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Dissect.Extended.Net --version 1.0.1
                    
NuGet\Install-Package Dissect.Extended.Net -Version 1.0.1
                    
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="Dissect.Extended.Net" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Dissect.Extended.Net" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Dissect.Extended.Net" />
                    
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 Dissect.Extended.Net --version 1.0.1
                    
#r "nuget: Dissect.Extended.Net, 1.0.1"
                    
#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 Dissect.Extended.Net@1.0.1
                    
#: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=Dissect.Extended.Net&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Dissect.Extended.Net&version=1.0.1
                    
Install as a Cake Tool

Dissect.Extended.Net

An implementation of the Dissect parser with additional extensions.

Introduction

A Dissect parser extracts structured data from a string by matching it against a predefined pattern. The parser compares the input string with the pattern and splits the input according to the Dissect rules.

For details about the original Dissect specification, see the official specification here.

This .NET implementation is fully compatible with the original specification while adding support for typedvalues beyond strings. It also provides a way to define append separators directly within the pattern.

Quickstart

Install the package from NuGet in your project.

Let's look at a simple example. Assume you have a log message like this:

2026-05-31 19:20:41 [Info] Successfully connected to server.

You can parse the message using the following Dissect pattern:

%{timestamp:DateTime[Europe/Berlin]} [%{log_level}] %{message}

This pattern parses the timestamp and interprets it using the IANA time zone Europe/Berlin.

The corresponding C# code:

var parser = new DissectParser("%{timestamp:DateTime[Europe/Berlin]} [%{log_level}] %{message}");

if (!parser.IsValid) throw new Exception("invalid parse expression");

var result = parser.Parse("2026-05-31 19:20:41 [Info] Successfully connected to server.");

if (result.Success)
{
	foreach (var keyValue in result.ToDictionary())
	{
		Console.WriteLine($"key: {key}, value: {value}");
	}
}

This produces the following output:

key: timestamp, value: 31/05/2026 17:20:41
key: log_level, value: Info
key: message, value: Successfully connected to server.

Note that all timestamps are converted to UTC before being returned.

Extensions

The following extensions to the Dissect grammar are supported.

Typed values

The original Dissect grammar only supports string values. This extended implementation can return strongly typed values by adding a typed value modifier to a key.

The typed value modifier is introduced with a colon (:). An optional parameter can be specified inside brackets ([ and ]) immediately following the typed value. The modifier can appear anywhere after the key name.

The only restriction is that the right-padding modifier (->) must always be the final modifier.

The following patterns are all valid:

%{keyname:DATATYPE}
%{keyname/n:DATATYPE}
%{keyname:DATATYPE/n}
%{keyname/n:DATATYPE->}
%{keyname:DATATYPE/n->}

The following data types are currently supported:

Type Parameter Remarks
string <None> Default type.
int <None>
float Culture name supported by the CultureInfo class. Useful for specifying whether decimal values use a period or comma separator.
double Culture name supported by the CultureInfo class. Useful for specifying whether decimal values use a period or comma separator.
decimal Culture name supported by the CultureInfo class. Useful for specifying whether decimal values use a period or comma separator.
datetime An IANA time zone. Values are returned as UTC DateTime instances.
time An IANA time zone. Interpreted relative to the current day and returned as a UTC DateTime.

All parameters are optional. Type names are case-insensitive.

The datetime and time typed values also support the special time zone value local, which refers to the system's local time zone.

[!NOTE] The timezone parameter of a datetime or time type will be ignored if the timezone is explicitly set via the parsed format. So e.g. a value "2026-05-31T19:20:41Z" will always be interpreted as UTC, independant of the timezone parameter.

When a typed value is used together with the append modifier, all partial definitions of the same key should use the same data type:

var parser = new DissectParser("%{value:DateTime} hello world %{+value:DateTime}", separator: " ");
var result = parser.Parse("2026-05-01 hello world 19:26:12");

Typed values can also be used with reference keys. In this case, the type should be defined on the value reference (&) part of the pair:

var parser = new DissectParser("%{*a} %{&a:DateTime}");
var result = parser.Parse("StartOfYear 2026-01-01");

Console.WriteLine(resultDict["StartOfYear"]);

Append Modifier Separator

When using append modifiers such as %{+key} %{+key}, values can be joined using a separator.

A separator can be specified globally when creating the parser:

var parser = new DissectParser(pattern, separator: "*");

Alternatively, it can be defined directly within the pattern by placing it in brackets immediately after the append modifier (+).

Different separators can be used within the same pattern. A separator defined on an append modifier remains active for subsequent append operations until another separator is specified.

Examples

Given the input:

this is a test

and a default separator of *, the following results are produced:

Pattern Result Remarks
%{+[,]a} %{+a} this,is a test
%{+a} %{+a} this*is a test The default separator is used because no explicit separator is defined.
%{+[...]a} %{+a} this...is a test
%{+[]a} %{+a} thisis a test
%{+[+]a} %{+[-]a} %{a} %{a} this+is-a-test The separator changes from + to - between the second and third append operation.

Source code

This library is published under the MIT-License (see license file for details). The source code can be found at github.

Product Compatible and additional computed target framework versions.
.NET 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

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.2 80 9/14/2026
1.0.1 300 6/17/2026
1.0.0 128 6/4/2026
0.2.4 116 6/3/2026
0.2.3 116 6/3/2026
0.2.2 117 6/1/2026
0.2.1 120 6/1/2026
0.2.0 118 6/1/2026
0.1.9 116 6/1/2026
0.1.5 121 6/1/2026
0.1.4 124 6/1/2026