{"id":7061,"date":"2022-12-20T19:34:49","date_gmt":"2022-12-20T22:34:49","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/fnmatch-man3\/"},"modified":"2022-12-20T19:34:49","modified_gmt":"2022-12-20T22:34:49","slug":"fnmatch-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/fnmatch-man3\/","title":{"rendered":"FnMatch (man3)"},"content":{"rendered":"<h1 align=\"center\">FnMatch<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#PATTERN SYNTAX\">PATTERN SYNTAX<\/a><br \/> <a href=\"#CAVEATS\">CAVEATS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#COPYRIGHT AND LICENSE\">COPYRIGHT AND LICENSE<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">File::FnMatch \u2212 simple filename and pathname matching<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use File::FnMatch qw(:fnmatch); # import everything <br \/> # shell\u2212style: match &#8220;\/a\/bc&#8221;, but not &#8220;\/a\/.bc&#8221; nor &#8220;\/a\/b\/c&#8221; <br \/> fnmatch(&#8220;\/a\/*&#8221;, $fn, FNM_PATHNAME|FNM_PERIOD); <br \/> # find our A\u2212 executables only <br \/> grep { fnmatch(&#8220;A\u2212*.exe&#8221;, $_) } readdir SOMEDIR;<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>File::FnMatch::fnmatch()<\/b> provides simple, shell-like pattern matching.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Though considerably less powerful than regular expressions, shell patterns are nonetheless useful and familiar to a large audience of end-users.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Functions<\/b> <br \/> fnmatch ( <small>PATTERN, STRING<\/small> [, <small>FLAGS<\/small> ] )<\/p>\n<p style=\"margin-left:17%;\">Returns true if <i><small>PATTERN<\/small><\/i> matches <i><small>STRING<\/small><\/i> , undef otherwise. <i><small>FLAGS<\/small><\/i> may be the bitwise <small>OR<\/small> \u2019ing of any supported FNM_* constants (see below).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Constants<\/b> <small><br \/> FNM_NOESCAPE<\/small><\/p>\n<p style=\"margin-left:17%;\">Do not treat a backslash (\u2019\u2019) in <i><small>PATTERN<\/small><\/i> specially. Otherwise, a backslash escapes the following character.<\/p>\n<p style=\"margin-left:11%;\"><small>FNM_PATHNAME<\/small><\/p>\n<p style=\"margin-left:17%;\">Prohibit wildcards from matching a slash (\u2019\/\u2019).<\/p>\n<p style=\"margin-left:11%;\"><small>FNM_PERIOD<\/small><\/p>\n<p style=\"margin-left:17%;\">Prohibit wildcards from matching a period (\u2019.\u2019) at the start of a string and, if <small>FNM_PATHNAME<\/small> is also given, immediately after a slash.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Other possibilities include at least <small>FNM_CASEFOLD<\/small> (compare &#8220;qr\/\/i&#8221;), <small>FNM_LEADING_DIR<\/small> to restrict matching to everything before the first \u2019\/\u2019, <small>FNM_FILE_NAME<\/small> as a synonym for <small>FNM_PATHNAME,<\/small> and the rather more exotic <small>FNM_EXTMATCH.<\/small> Consult your system documentation for details.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><small>EXPORT<\/small><\/b> <br \/> None by default. The export tag &#8220;:fnmatch&#8221; exports the fnmatch function and all available FNM_* constants.<\/p>\n<h2>PATTERN SYNTAX <a name=\"PATTERN SYNTAX\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Wildcards are the question mark (\u2019?\u2019) to match any single character and the asterisk (\u2019*\u2019) to match zero or more characters. <small>FNM_PATHNAME<\/small> and <small>FNM_PERIOD<\/small> restrict the scope of the wildcards, notably supporting the <small>UNIX<\/small> convention of concealing &#8220;dotfiles&#8221;:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Bracket expressions, enclosed by \u2019[\u2019 and \u2019]\u2019, match any of a set of characters specified explicitly (&#8220;[abcdef]&#8221;), as a range (&#8220;[a\u2212f0\u22129]&#8221;), or as the combination these (&#8220;[a\u2212f0\u22129XYZ]&#8221;). Additionally, many implementations support named character classes such as &#8220;[[:xdigit:]]&#8221;. Character sets may be negated with an initial \u2019!\u2019 (&#8220;[![:space:]]&#8221;).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Locale influences the meaning of <b>fnmatch()<\/b> patterns.<\/p>\n<h2>CAVEATS <a name=\"CAVEATS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Most UNIX-like systems provide an fnmatch implementation. This module will not work on platforms lacking an implementation, most notably Win32.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">File::Glob, POSIX::setlocale, <b>fnmatch<\/b>(3)<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Michael J. Pomraning<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Please report bugs to <mjp\u2212perl <small>AT<\/small> pilcrow.madison.wi.us><\/p>\n<h2>COPYRIGHT AND LICENSE <a name=\"COPYRIGHT AND LICENSE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright 2005 by Michael J. Pomraning<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This library is free software; you can redistribute it and\/or modify it under the same terms as Perl itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  File::FnMatch \u2212 simple filename and pathname matching <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3407,3007],"class_list":["post-7061","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-filefnmatch","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7061"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7061\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7061"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}