Skip to content

WichardRiezebos/ant-path-matching

Repository files navigation

Ant Path Matching

Build status NuGet Join the chat at https://gitter.im/ant-path-matching/Lobby

Package for matching paths (files, directories) using the apache ant-style.

Prerequisites

  • .NET Framework 2.0

Installation

Install the NuGet package using the command below:

Install-Package AntPathMatching

...or search for "AntPathMatching" in the NuGet index.

Getting started

The code below is an example how to use the library.

Standalone match

using AntPathMatching;
...
var ant = new Ant("/assets/**/*.{js,css}");
var isMatch = ant.IsMatch("/assets/scripts/vendor/angular.js");

Recursive match

using AntPathMatching;
...
var ant = new Ant("/assets/**/*.js");
var antDir = new AntDirectory(ant);
var matchingFiles = ant.SearchRecursively("C:\directory\", includeDirectoryPath: false);

Dependency Injection

using AntPathMatching;
...
constructor(
	IAntFactory antFactory,				
	IAntDirectoryFactory antDirectoryFactory
) {
	var ant = antFactory.CreateNew("/assets/**/*.js");
	var antDir = antDirectoryFactory.CreateNew(ant);
}