.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" 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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 "2018-11-01" "perl v5.28.0" "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 ( \s-1PATTERN, STRING\s0 [, \s-1FLAGS\s0] )" 4 .IX Item "fnmatch ( PATTERN, STRING [, FLAGS] )" Returns true if \fI\s-1PATTERN\s0\fR matches \fI\s-1STRING\s0\fR, undef otherwise. \fI\s-1FLAGS\s0\fR may be the bitwise \s-1OR\s0'ing of any supported FNM_* constants (see below). .SS "Constants" .IX Subsection "Constants" .IP "\s-1FNM_NOESCAPE\s0" 4 .IX Item "FNM_NOESCAPE" Do not treat a backslash ('\e') in \fI\s-1PATTERN\s0\fR specially. Otherwise, a backslash escapes the following character. .IP "\s-1FNM_PATHNAME\s0" 4 .IX Item "FNM_PATHNAME" Prohibit wildcards from matching a slash ('/'). .IP "\s-1FNM_PERIOD\s0" 4 .IX Item "FNM_PERIOD" Prohibit wildcards from matching a period ('.') at the start of a string and, if \s-1FNM_PATHNAME\s0 is also given, immediately after a slash. .PP Other possibilities include at least \s-1FNM_CASEFOLD\s0 (compare \f(CW\*(C`qr//i\*(C'\fR), \&\s-1FNM_LEADING_DIR\s0 to restrict matching to everything before the first '/', \&\s-1FNM_FILE_NAME\s0 as a synonym for \s-1FNM_PATHNAME,\s0 and the rather more exotic \&\s-1FNM_EXTMATCH.\s0 Consult your system documentation for details. .SS "\s-1EXPORT\s0" .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. \s-1FNM_PATHNAME\s0 and \s-1FNM_PERIOD\s0 restrict the scope of the wildcards, notably supporting the \s-1UNIX\s0 convention of concealing \*(L"dotfiles\*(R": .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.