A minimal matching utility.

\href{http://travis-ci.org/isaacs/minimatch}{\texttt{ }}

This is the matching library used internally by npm.

It works by converting glob expressions into Java\+Script {\ttfamily Reg\+Exp} objects.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17594}{}\doxysection{Usage}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17594}

\begin{DoxyCode}{0}
\DoxyCodeLine{var minimatch = require("{}minimatch"{})}
\DoxyCodeLine{}
\DoxyCodeLine{minimatch("{}bar.foo"{}, "{}*.foo"{}) // true!}
\DoxyCodeLine{minimatch("{}bar.foo"{}, "{}*.bar"{}) // false!}
\DoxyCodeLine{minimatch("{}bar.foo"{}, "{}*.+(bar|foo)"{}, \{ debug: true \}) // true, and noisy! }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17595}{}\doxysection{Features}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17595}
Supports these glob features\+:


\begin{DoxyItemize}
\item Brace Expansion
\item Extended glob matching
\item \char`\"{}\+Globstar\char`\"{} {\ttfamily $\ast$$\ast$} matching
\end{DoxyItemize}

See\+:


\begin{DoxyItemize}
\item {\ttfamily man sh}
\item {\ttfamily man bash}
\item {\ttfamily man 3 fnmatch}
\item {\ttfamily man 5 gitignore}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17596}{}\doxysection{Minimatch Class}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17596}
Create a minimatch object by instantiating the {\ttfamily minimatch.\+Minimatch} class.


\begin{DoxyCode}{0}
\DoxyCodeLine{var Minimatch = require("{}minimatch"{}).Minimatch}
\DoxyCodeLine{var mm = new Minimatch(pattern, options) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17597}{}\doxysubsection{Properties}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17597}

\begin{DoxyItemize}
\item {\ttfamily pattern} The original pattern the minimatch object represents.
\item {\ttfamily options} The options supplied to the constructor.
\item {\ttfamily set} A 2-\/dimensional array of regexp or string expressions. Each row in the array corresponds to a brace-\/expanded pattern. Each item in the row corresponds to a single path-\/part. For example, the pattern {\ttfamily \{a,b/c\}/d} would expand to a set of patterns like\+: \begin{DoxyVerb}  [ [ a, d ]
  , [ b, c, d ] ]
\end{DoxyVerb}
 If a portion of the pattern doesn\textquotesingle{}t have any \char`\"{}magic\char`\"{} in it (that is, it\textquotesingle{}s something like {\ttfamily \char`\"{}foo\char`\"{}} rather than {\ttfamily fo$\ast$o?}), then it will be left as a string rather than converted to a regular expression.
\item {\ttfamily regexp} Created by the {\ttfamily make\+Re} method. A single regular expression expressing the entire pattern. This is useful in cases where you wish to use the pattern somewhat like {\ttfamily fnmatch(3)} with {\ttfamily FNM\+\_\+\+PATH} enabled.
\item {\ttfamily negate} True if the pattern is negated.
\item {\ttfamily comment} True if the pattern is a comment.
\item {\ttfamily empty} True if the pattern is {\ttfamily \char`\"{}\char`\"{}}.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17598}{}\doxysubsection{Methods}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17598}

\begin{DoxyItemize}
\item {\ttfamily make\+Re} Generate the {\ttfamily regexp} member if necessary, and return it. Will return {\ttfamily false} if the pattern is invalid.
\item {\ttfamily match(fname)} Return true if the filename matches the pattern, or false otherwise.
\item {\ttfamily match\+One(file\+Array, pattern\+Array, partial)} Take a {\ttfamily /}-\/split filename, and match it against a single row in the {\ttfamily reg\+Exp\+Set}. This method is mainly for internal use, but is exposed so that it can be used by a glob-\/walker that needs to avoid excessive filesystem calls.
\end{DoxyItemize}

All other methods are internal, and will be called as necessary.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17599}{}\doxysubsection{minimatch(path, pattern, options)}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17599}
Main export. Tests a path against the pattern using the options.


\begin{DoxyCode}{0}
\DoxyCodeLine{var isJS = minimatch(file, "{}*.js"{}, \{ matchBase: true \}) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17600}{}\doxysubsection{minimatch.\+filter(pattern, options)}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17600}
Returns a function that tests its supplied argument, suitable for use with {\ttfamily Array.\+filter}. Example\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var javascripts = fileList.filter(minimatch.filter("{}*.js"{}, \{matchBase: true\})) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17601}{}\doxysubsection{minimatch.\+match(list, pattern, options)}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17601}
Match against the list of files, in the style of fnmatch or glob. If nothing is matched, and options.\+nonull is set, then return a list containing the pattern itself.


\begin{DoxyCode}{0}
\DoxyCodeLine{var javascripts = minimatch.match(fileList, "{}*.js"{}, \{matchBase: true\})) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17602}{}\doxysubsection{minimatch.\+make\+Re(pattern, options)}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17602}
Make a regular expression object from the pattern.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17603}{}\doxysection{Options}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17603}
All options are {\ttfamily false} by default.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17604}{}\doxysubsection{debug}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17604}
Dump a ton of stuff to stderr.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17605}{}\doxysubsection{nobrace}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17605}
Do not expand {\ttfamily \{a,b\}} and {\ttfamily \{1..3\}} brace sets.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17606}{}\doxysubsection{noglobstar}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17606}
Disable {\ttfamily $\ast$$\ast$} matching against multiple folder names.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17607}{}\doxysubsection{dot}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17607}
Allow patterns to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot.

Note that by default, {\ttfamily a/$\ast$$\ast$/b} will {\bfseries{not}} match {\ttfamily a/.d/b}, unless {\ttfamily dot} is set.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17608}{}\doxysubsection{noext}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17608}
Disable \char`\"{}extglob\char`\"{} style patterns like {\ttfamily +(a$\vert$b)}.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17609}{}\doxysubsection{nocase}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17609}
Perform a case-\/insensitive match.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17610}{}\doxysubsection{nonull}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17610}
When a match is not found by {\ttfamily minimatch.\+match}, return a list containing the pattern itself if this option is set. When not set, an empty list is returned if there are no matches.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17611}{}\doxysubsection{match\+Base}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17611}
If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, {\ttfamily a?b} would match the path {\ttfamily /xyz/123/acb}, but not {\ttfamily /xyz/acb/123}.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17612}{}\doxysubsection{nocomment}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17612}
Suppress the behavior of treating {\ttfamily \#} at the start of a pattern as a comment.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17613}{}\doxysubsection{nonegate}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17613}
Suppress the behavior of treating a leading {\ttfamily !} character as negation.\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17614}{}\doxysubsection{flip\+Negate}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17614}
Returns from negate expressions the same as if they were not negated. (Ie, true on a hit, false on a miss.)\hypertarget{md_sfcode_node_modules_minimatch_README_autotoc_md17615}{}\doxysection{Comparisons to other fnmatch/glob implementations}\label{md_sfcode_node_modules_minimatch_README_autotoc_md17615}
While strict compliance with the existing standards is a worthwhile goal, some discrepancies exist between minimatch and other implementations, and are intentional.

If the pattern starts with a {\ttfamily !} character, then it is negated. Set the {\ttfamily nonegate} flag to suppress this behavior, and treat leading {\ttfamily !} characters normally. This is perhaps relevant if you wish to start the pattern with a negative extglob pattern like {\ttfamily !(a$\vert$B)}. Multiple {\ttfamily !} characters at the start of a pattern will negate the pattern multiple times.

If a pattern starts with {\ttfamily \#}, then it is treated as a comment, and will not match anything. Use {\ttfamily \textbackslash{}\#} to match a literal {\ttfamily \#} at the start of a line, or set the {\ttfamily nocomment} flag to suppress this behavior.

The double-\/star character {\ttfamily $\ast$$\ast$} is supported by default, unless the {\ttfamily noglobstar} flag is set. This is supported in the manner of bsdglob and bash 4.\+1, where {\ttfamily $\ast$$\ast$} only has special significance if it is the only thing in a path part. That is, {\ttfamily a/$\ast$$\ast$/b} will match {\ttfamily a/x/y/b}, but {\ttfamily a/$\ast$$\ast$b} will not.

If an escaped pattern has no matches, and the {\ttfamily nonull} flag is set, then minimatch.\+match returns the pattern as-\/provided, rather than interpreting the character escapes. For example, {\ttfamily minimatch.\+match(\mbox{[}\mbox{]}, \char`\"{}\textbackslash{}\textbackslash{}$\ast$a\textbackslash{}\textbackslash{}?\char`\"{})} will return {\ttfamily \char`\"{}\textbackslash{}\textbackslash{}$\ast$a\textbackslash{}\textbackslash{}?\char`\"{}} rather than {\ttfamily \char`\"{}$\ast$a?\char`\"{}}. This is akin to setting the {\ttfamily nullglob} option in bash, except that it does not resolve escaped pattern characters.

If brace expansion is not disabled, then it is performed before any other interpretation of the glob pattern. Thus, a pattern like {\ttfamily +(a$\vert$\{b),c)\}}, which would not be valid in bash or zsh, is expanded {\bfseries{first}} into the set of {\ttfamily +(a$\vert$b)} and {\ttfamily +(a$\vert$c)}, and those patterns are checked for validity. Since those two are valid, matching proceeds. 