.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "FnMatch 3pm" .TH FnMatch 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME File::FnMatch \- simple filename and pathname matching .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use File::FnMatch qw(:fnmatch); # import everything \& \& # shell\-style: match "/a/bc", but not "/a/.bc" nor "/a/b/c" \& fnmatch("/a/*", $fn, FNM_PATHNAME|FNM_PERIOD); \& \& # find our A\- executables only \& grep { fnmatch("A\-*.exe", $_) } readdir SOMEDIR; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBFile::FnMatch::fnmatch()\fR provides simple, shell-like pattern matching. .PP Though considerably less powerful than regular expressions, shell patterns are nonetheless useful and familiar to a large audience of end-users. .SS Functions .IX Subsection "Functions" .IP "fnmatch ( PATTERN, STRING [, FLAGS] )" 4 .IX Item "fnmatch ( PATTERN, STRING [, FLAGS] )" Returns true if \fIPATTERN\fR matches \fISTRING\fR, undef otherwise. \fIFLAGS\fR may be the bitwise OR'ing of any supported FNM_* constants (see below). .SS Constants .IX Subsection "Constants" .IP FNM_NOESCAPE 4 .IX Item "FNM_NOESCAPE" Do not treat a backslash ('\e') in \fIPATTERN\fR specially. Otherwise, a backslash escapes the following character. .IP FNM_PATHNAME 4 .IX Item "FNM_PATHNAME" Prohibit wildcards from matching a slash ('/'). .IP FNM_PERIOD 4 .IX Item "FNM_PERIOD" Prohibit wildcards from matching a period ('.') at the start of a string and, if FNM_PATHNAME is also given, immediately after a slash. .PP Other possibilities include at least FNM_CASEFOLD (compare \f(CW\*(C`qr//i\*(C'\fR), FNM_LEADING_DIR to restrict matching to everything before the first '/', FNM_FILE_NAME as a synonym for FNM_PATHNAME, and the rather more exotic FNM_EXTMATCH. Consult your system documentation for details. .SS EXPORT .IX Subsection "EXPORT" None by default. The export tag \f(CW\*(C`:fnmatch\*(C'\fR exports the fnmatch function and all available FNM_* constants. .SH "PATTERN SYNTAX" .IX Header "PATTERN SYNTAX" Wildcards are the question mark ('?') to match any single character and the asterisk ('*') to match zero or more characters. FNM_PATHNAME and FNM_PERIOD restrict the scope of the wildcards, notably supporting the UNIX convention of concealing "dotfiles": .PP Bracket expressions, enclosed by '[' and ']', match any of a set of characters specified explicitly (\f(CW\*(C`[abcdef]\*(C'\fR), as a range (\f(CW\*(C`[a\-f0\-9]\*(C'\fR), or as the combination these (\f(CW\*(C`[a\-f0\-9XYZ]\*(C'\fR). Additionally, many implementations support named character classes such as \f(CW\*(C`[[:xdigit:]]\*(C'\fR. Character sets may be negated with an initial '!' (\f(CW\*(C`[![:space:]]\*(C'\fR). .PP Locale influences the meaning of \fBfnmatch()\fR patterns. .SH CAVEATS .IX Header "CAVEATS" Most UNIX-like systems provide an fnmatch implementation. This module will not work on platforms lacking an implementation, most notably Win32. .SH "SEE ALSO" .IX Header "SEE ALSO" File::Glob, POSIX::setlocale, \&\fBfnmatch\fR\|(3) .SH AUTHOR .IX Header "AUTHOR" Michael J. Pomraning .PP Please report bugs to .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2005 by Michael J. Pomraning .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.