Module posix.fnmatch

Filename matching.

Functions and constants for matching known filenames against shell-style pattern strings.

Functions

fnmatch (pat, name[, flags=0]) Match a filename against a shell pattern.

Constants

posix.fnmatch Fnmatch constants.


Functions

fnmatch (pat, name[, flags=0])
Match a filename against a shell pattern.

Parameters:

  • pat string shell pattern
  • name string filename
  • flags int optional (default 0)

Returns:

    int 0, if successful

Or

    int FNM_NOMATCH

Or

    int some other non-zero integer if fnmatch itself failed

See also:

Constants

posix.fnmatch
Fnmatch constants. Any constants not available in the underlying system will be nil valued.

Fields:

  • FNM_PATHNAME int slashes in pathname must be matched by slash in pattern
  • FNM_NOESCAPE int disable backslash escaping
  • FNM_NOMATCH int match failed
  • FNM_PERIOD int periods in pathname must be matched by period in pattern

Usage:

      -- Print fnmatch constants supported on this host.
      for name, value in pairs (require "posix.fnmatch") do
        if type (value) == "number" then
          print (name, value)
         end
      end
generated by LDoc 1.4.3 Last updated 2015-03-01 09:06:02