3 A minimal matching utility.
5 [![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)
8 This is the matching library used internally by npm.
10 Eventually, it will replace the C binding in node-glob.
12 It works by converting glob expressions into JavaScript `RegExp`
18 var minimatch = require("minimatch")
20 minimatch("bar.foo", "*.foo") // true!
21 minimatch("bar.foo", "*.bar") // false!
26 Supports all glob features.
34 ### Departures from zsh/bash/ksh/sh
36 If the pattern starts with a `!` character, then it is negated.
38 If a pattern starts with `#`, then it is treated as a comment, and
39 will not match anything. (Use `\#` to match a literal `#` at the
42 The double-star `**` is always supported, instead of requiring a special
45 If an escaped pattern has no matches, and the `null` flag is not set,
46 then minimatch.match returns the pattern as-provided, rather than
47 interpreting the character escapes. For example,
48 `minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
53 ### minimatch(path, pattern, options)
55 Main export. Tests a path against
56 the pattern using the options.
58 ### minimatch.filter(pattern, options)
60 Returns a function that tests its
61 supplied argument, suitable for use with `Array.filter`.
63 ### minimatch.match(list, pattern, options)
65 Match against the list of
66 files, in the style of fnmatch or glob. If nothing is matched, then
67 return the pattern (unless `{ null: true }` in the options.)
69 ### minimatch.makeRe(pattern, options)
71 Make a regular expression object
76 All options are `false` by default.
80 Dump a ton of stuff to stderr.
84 Return an empty list from minimatch.match, instead of a list
85 containing the pattern itself.
89 Perform a case-insensitive match.
93 An LRU cache with `.get(k)` and `.set(k,v)` methods. By
94 default, an instance of `node-lru-cache` is used, with 1000 max
99 If set, then `a/*` will match `a/` as well as `a/b`.
103 If set, then patterns without slashes will be matched
104 against the basename of the path if it contains slashes. For example,
105 `a?b` would match `xyz/123/acb`.
109 Internal. Used by `minimatch.makeRe`.
113 Allow patterns to match paths starting with a period, even if
114 the pattern does not explicitly start with a period.