|This article relies largely or entirely upon a single source. (May 2016)|
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.
In telecommunications, a wildcard is a character that may be substituted for any of a defined subset of all possible characters.
- In high-frequency (HF) radio automatic link establishment, the wildcard character
?may be substituted for any one of the 36 upper-case alphanumeric characters.
- Whether the wildcard character represents a single character or a string of characters must be specified.
File and directory patterns
When specifying file names (or paths) in CP/M, DOS, Microsoft Windows, and Unix-like operating systems, the asterisk character (
*, also called "star") matches zero or more characters. For example,
document but not
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, the pattern
123? will match
1234, but not
In Unix shells and Windows PowerShell, ranges of characters enclosed in square brackets (
]) match a single character within the set; for example,
[A-Za-z] matches any single uppercase or lowercase letter. In Unix shells, a leading exclamation mark
! negates the set and matches only a character not within the list. In shells that interpret
! as a history substitution, a leading caret
^ can be used instead.
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 (
]) to list sets and ranges of characters to match, a leading caret
^ negates the set and matches only a character not within the list. In Microsoft Access, 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 for sets or ranges of characters to match.
In this case, the asterisk is also known as the Kleene star.
- This article incorporates public domain material from the General Services Administration document "Federal Standard 1037C" (in support of MIL-STD-188).