In computer science, an algorithm for matching wildcards (also known as globbing) is useful in comparing text strings that may contain wildcard syntax. Common uses of these algorithms include command-line interfaces, e.g. the Bourne shell or Microsoft Windows command-line or text editor or file manager, as well as the interfaces for some search engines and databases. Wildcard matching is a subset of the problem of matching regular expressions and string matching in general.
The problem A wildcard matcher tests a wildcard pattern p against an input string s. It performs an anchored match; that is, it returns true only when p matches the entirety of s. The pattern can be based on any common syntax (see globbing). However, on Windows, programmers tend to only discuss a simplified syntax supported by the native C runtime:
No escape characters are defined Wildcards: ? matches exactly one occurrence of any character. * matches arbitrarily many (including zero) occurrences of any character. This article mainly discusses the Windows formulation of the problem, unless otherwise stated.
Definition Stated in zero-based indices, the wildcard-matching problem can be defined recursively as:
… excerpt ends here. Continue reading the full article.
