Wildcard character

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In software, a wildcard character is a single character, such as an asterisk (*), used to represent a number of characters or an empty string. It is often used in file searches so the full name need not be typed.[1]


In telecommunications, a wildcard is a character that may be substituted for any of a defined subset of all possible characters.


In computer (software) technology, a wildcard character can be used to substitute for any other character or characters in a string.

File and directory patterns[edit]

When specifying file names (or paths) in CP/M, DOS, Microsoft Windows, and Unix-like operating systems, the asterisk pattern character (*, also called "star") matches zero or more characters.

In Unix-like and DOS operating systems, the question mark ? matches exactly one character; in DOS, if the question mark is placed at the end of the word, it will also match missing (zero) trailing characters. For example, in DOS, the pattern 123??? will match 12345 or 123456, but not 1234567.

In Unix shells and Windows PowerShell, ranges of characters enclosed in square brackets ([ and ]) match a single character within the range; for example, [A-Za-z] matches any single uppercase or lowercase letter. Unix shells allow negation of the specified character set by using a leading ! (e.g., foo.[!ch], which will match names like foo.o). In shells that interpret ! as a history substitution, a leading ^ can be used instead of ! to negate the character set.

The operation of matching of wildcard patterns to multiple file or path names is referred to as globbing.


In SQL, wildcard characters can be used in LIKE expressions; the percent sign % matches zero or more characters, and underscore _ a single character. Transact-SQL also supports square brackets ([ and ]) to list sets and ranges of characters to match, a leading caret ^ matches only a character not specified within the brackets. In Microsoft Access, wildcard characters can be used in LIKE expressions; the asterisk sign * matches zero or more characters, the question mark ? matches a single character, the number sign # matches a single digit (0-9), and square brackets can be used to enclose sets or ranges of characters to match.

Regular expressions[edit]

In regular expressions, the period (., also called "dot") is the wildcard pattern character that matches a single character. Combined with the asterisk operator .* it will match any number of characters.

In this case, the asterisk is also known as the Kleene star.

See also[edit]


  1. ^ https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/find_c_search_wildcard.mspx?mfr=true

External links[edit]