1 \section{\module{fnmatch
} ---
2 \UNIX{} filename pattern matching
}
4 \declaremodule{standard
}{fnmatch
}
5 \modulesynopsis{\UNIX\ shell style filename pattern matching.
}
8 \index{filenames!wildcard expansion
}
10 This module provides support for
\UNIX{} shell-style wildcards, which
11 are
\emph{not
} the same as regular expressions (which are documented
12 in the
\refmodule{re
}\refstmodindex{re
} module). The special
13 characters used in shell-style wildcards are:
15 \begin{tableii
}{c|l
}{code
}{Pattern
}{Meaning
}
16 \lineii{*
}{matches everything
}
17 \lineii{?
}{matches any single character
}
18 \lineii{[\var{seq
}]}{matches any character in
\var{seq
}}
19 \lineii{[!
\var{seq
}]}{matches any character not in
\var{seq
}}
22 Note that the filename separator (
\code{'/'
} on
\UNIX{}) is
\emph{not
}
23 special to this module. See module
24 \refmodule{glob
}\refstmodindex{glob
} for pathname expansion
25 (
\refmodule{glob
} uses
\function{fnmatch()
} to match pathname
26 segments). Similarly, filenames starting with a period are
27 not special for this module, and are matched by the
\code{*
} and
31 \begin{funcdesc
}{fnmatch
}{filename, pattern
}
32 Test whether the
\var{filename
} string matches the
\var{pattern
}
33 string, returning true or false. If the operating system is
34 case-insensitive, then both parameters will be normalized to all
35 lower- or upper-case before the comparison is performed. If you
36 require a case-sensitive comparison regardless of whether that's
37 standard for your operating system, use
\function{fnmatchcase()
}
41 \begin{funcdesc
}{fnmatchcase
}{filename, pattern
}
42 Test whether
\var{filename
} matches
\var{pattern
}, returning true or
43 false; the comparison is case-sensitive.
48 \seemodule{glob
}{\UNIX{} shell-style path expansion.
}