\input texinfo
@setfilename wildcard.info
@newindex {fn}

@chapter The Wildcard Module

Wildcards, also called ``Shell Filename Patterns'', describe sets of file names.

The @code{wildcard} package exports the following symbol:

@defun match pattern string [:start] [:end] [:case-insensitive]
This function returns a non-@code{nil} value if the @var{string} matches
the @var{pattern}.

@end defun

@chapter Wildcard Syntax

@table @code
@item *
Matches any zero or more characters.

@item ?
Matches any one character.

@item [@var{string}]
Matches exactly one character that is a member of the string
@var{string}.  This is called a @dfn{character class}.  As a shorthand,
@var{string} may contain ranges, which consist of two characters with a
dash between them.  For example, the class @samp{[a-z0-9_]} matches a
lowercase letter, a number, or an underscore.  You can negate a class by
placing a @samp{!} or @samp{^} immediately after the opening bracket.
Thus, @samp{[^A-Z@@]} matches any character except an uppercase letter
or an at sign.

@item \
Removes the special meaning of the character that follows it.  This
works even in character classes.
@end table

Slash characters have no special significance in the wildcard matching,
unlike in the shell, in
which wildcards do not match them.  Therefore, a pattern @samp{foo*bar}
can match a file name @samp{foo3/bar}, and a pattern @samp{./sr*sc} can
match a file name @samp{./src/misc}.

@bye

