This is Glob, a Haskell library for globbing, i.e. pattern matching file pathsakin to the POSIX glob() function. Haddock documentation is included, and canbe built with the 'cabal haddock' command. Basic usage info is repeated below:

Matching pattern (a String) against filepath (a FilePath):

match (compile pattern) filepath

Matching a pattern against all paths in the current working directory:

glob pattern

Matching a pattern against all paths in a given directory (a FilePath):

globDir1 (compile pattern) directorypath

Matching a list of patterns against all paths in a given directory, returningthe matches for each pattern as well as the paths not matched by any of thepatterns:

globDir (map compile patterns) directorypath

Changes

0.10.0, 2018-12-19: Bug fix: "**/" matched hidden directories in some scenarios even when matchDotsImplicitly was set to False. Thanks to Travis Sunderland for the report as well as the fix.

This is a significant performance boost for all glob* functions when unmatched file paths are not desired.

Optimization: when unmatched file paths are not requested, glob and globDir1 use commonDirectory to avoid extra getDirectoryContents calls at the start. Optimization: character ranges containing . or / are simplified more than before, especially when they make the entire pattern incapable of matching anything. Optimization: extension separator matching where the extension is surrounded by other literals (e.g. "*.txt" or "foo.*" or simply "foo.txt") should be quicker in general, and the Patterns should be smaller. (This adds to the number of places where the code assumes that the extension separator is the '.' character.)

Bug fix: commonDirectory should no longer add extra directory separators to the Pattern. Bug fix: the glob* functions should now place slashes correctly when using recursively matching patterns with extra slashes, such as "**//foo". Bug fix: number ranges are no longer optimized to single characters, so that leading zeroes are handled correctly: e.g. "<0-9>" didn't match "007". Bug fix: "//" did not match itself. Bug fix: ".//" did not match itself. Bug fix: "x" did not match ".//x" (with ignoreDotSlash enabled). Bug fix: "<-><->" matched single digit numbers. Bug fix: "<0-0><1-1>" didn't match "01".

Change: ".." can now be matched, by patterns such as ".*". Change: globDir, given "" as the directory, uses getCurrentDirectory. Change: globDir now keeps track of the number of path separators, thus "a//*" will return "a//b" instead of "a/b" as a match result. Change: if character ranges begin with ! or ^, these characters are now considered the start of the range: [^-~] is the range ^ through ~, not the inverse of [-~].

Regression fix: handle directories without read permissions even more properly.