This project is read-only.

MatchKit is a .NET Library that provides a set of classes to build patterns to match simple and complex strings. 

Download of the latest release is also available on Nuget Gallery.
HTML documentation is available here.
An overview article is available on CodeProject.

The core classes are available in MatchKit namespace. The root pattern interface is IPattern and a common base implementation for all the built-ins patterns is BasePattern. The matching process is based on the MatchContext that keep tracks of matching state and provides a set of facilitating methods to performs match operations. Each match resulted from a pattern is described in a Match object. A set of MatchOptions permits to control the process and an optional IMatchTrace object to log the match activity.

The MatchKit.Patterns namespace provides the base common BasePattern implementation and a set of built-in patterns.

The MatchKit.ObjectMapping namespace provides classes to map patterns onto custom classes. The process in this case is centred on a custom class marked with MatchableClassAttribute; this class can contains each type of member, but only those marked with the MatchableMemberAttribute are eligible for the matching process. The declared type of a member is used to determine a default pattern to use (for example for String type the WordPattern will be used). Specific patterns can be applied to a member through custom attributes that inherits from PatternBaseAttribute. A set of built-in attributes is available in MatchKit.ObjectMapping.Attributes namespace.
The object mapping process exposes some useful options as the MatchingBag to keep track of all matched members, or the IgnoreBlanks to ignore automatically spaces and newlines. The entire mapping process can be customized also with IMatchMappingEvents to handle value assignation to the matchable members and dynamic value pattern creation.
A class can be mapped from a string invoking the Map method of the ObjectMapper class.

Both plain patterns and mapped objects have the possibility to perform string replacement through Replace extension methods or through the ObjectReplacer class.

Last edited Apr 18, 2014 at 8:16 AM by fabiobussu, version 9