Wildcards are symbols that represent any character or combination of characters.

In software, a wildcard character is a kind of placeholder represented by a single character, such as an asterisk (*), which can be interpreted as a number of literal 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.

Computing[edit]

In computer (software) technology, a wildcard is a symbol used to replace or represent one or more characters.[2] Algorithms for matching wildcards have been developed in a number of recursive and non-recursive varieties.[3]

File and directory patterns[edit]

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, doc* matches doc and document but not dodo. If files are named with a date stamp, wildcards can be used to match date ranges, such as 202212*.mp4 to select video recordings from December 2022, to facilitate file operations such as copying and moving.

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 123 and *0, but not *1.

In Unix shells and Windows PowerShell, ranges of characters enclosed in square brackets (*2 and *3) match a single character within the set; for example, *4 matches any single uppercase or lowercase letter. In Unix shells, a leading exclamation mark *5 negates the set and matches only a character not within the list. In shells that interpret *5 as a history substitution, a leading caret *7 can be used instead.

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

Databases[edit]

In SQL, wildcard characters can be used in LIKE expressions; the percent sign *8 matches zero or more characters, and underscore *9 a single character. Transact-SQL also supports square brackets (*2 and *3) to list sets and ranges of characters to match, a leading caret *7 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 doc*5 matches a single digit (0–9), and square brackets can be used for sets or ranges of characters to match.

Regular expressions[edit]

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

Alternatively referred to as a wild character or wildcard character, a wildcard is a symbol used to replace or represent one or more characters. The most common wildcards are the asterisk (*), which represents one or more characters, and question mark (?), which represents a single character. In the examples below of how a wildcard may be used, realize that wildcards are relatively universal.

  • Wildcard basics.
  • MS-DOS and Windows command line wildcard examples.
  • Find and replace using wildcard examples.
  • Linux and Unix wildcard examples.
  • Microsoft Excel wildcard examples.

Wildcard basics

Percent ( % ) in a wildcard

The percent symbol is used in SQL to match any character (including an underscore) zero or more times.

Asterisk ( * ) in a wildcard

The asterisk in a wildcard matches any character zero or more times. For example, "comp*" matches anything beginning with "comp," which means "comp," "complete," and "computer" are all matched.

Question mark ( ? ) in a wildcard

A question mark matches a single character once. For example, "c?mp" matches "camp" and "comp." The question mark can also be used more than once. For example, "c??p" would match both of the above examples. In MS-DOS and the Windows command line, the question mark can also match any trailing question marks zero or one time. For example, "co??" would match all of the above matches, but because they are trailing question marks would also match "cop" even though it's not four characters.

Tip

With regular expressions, a period ( . ) is a wildcard for a single character.

Open and close brackets ( [ ] ) in a wildcard

With Unix shells, Windows PowerShell, and programming languages that support regular expressions, the open and close bracket wildcards match a single character in a range. For example, [a-z] matches any character "a" through "z," which means anything not in that range, like a number, would not be matched.

Tip

Adding an exclamation mark in places that support the brackets as a wildcard will tell the program to NOT match.

MS-DOS and Windows command line wildcard examples

dir c?mp

List files in MS-DOS using the dir command containing c, mp, and any other character between. For example, comp, camp, c2mp, and c-mp would all be matched.

dir *.mp3

In this next example, the dir command would only list files that end with .MP3 file extension.

dir *data

List any file that ends with data using the dir command. For example, the files "appdata," "mydata," and "123data" would all be matched.

dir he??.*

List any file four characters long that begins with he, and has any extension. For example, help.txt, help.mp3, and heck.jpg would all be matched.

rename *.txt *.jpg

Rename all files in the current directory that end with the file extension .txt to .jpg. For example, the file test.txt would become test.jpg.

del comp*.txt

Deleting files in MS-DOS that begin with comp and end with a ".txt" extension.

Find and replace using wildcard examples

Find and replace features that support wildcards, like Microsoft Word, that allow searches to contain wildcards. Below are examples of how to use wildcards in Find and Replace. Remember that for any of these to work; you must have the Use wildcards option checked in Find and Replace.

comp*r

Match anything starting with "comp" and ending with "r." In other words, this would find "computer" and "compiler" in your document. However, remember that "*" is greedy, meaning everything is matched up to "r." In other words, if there's an "r" anywhere after comp, it's matched. So, "computer your" is matched since it begins with "comp" and "your" ends with "r."

d[eo]ll

Using brackets, indicate to Microsoft Word to look for any of the letters contained in the brackets. In this example, "e" or "o" are matched, so find would match either "dell" or "doll."

d[o-u]ll

The brackets can also be used to search for a range of characters. In the above example, this range includes the letters from "o" to "u." This range matches words like "doll" and "dull" in your document.

d[!e]ll

Using an exclamation mark in the brackets tells the Find not to match any of the characters in the bracket. In the above example, this wildcard tells the Find not to match "dell," but to match anything else beginning with "d" and ending in 'll.'

dir *.mp3
0

The question mark only matches one character. In the above example, this would match "dall," "dell," "dill," "doll," and "dull" since they contain a "d" at the first and "ll" at the end.

dir *.mp3
1

Using a curly bracket in your Find looks for the number of characters preceding the brackets. In the above example, Find matches "seed," but not match "sed."

dir *.mp3
2

A find starting with a less than and containing text in parentheses tells Find to look for any word beginning with whatever is contained in the parentheses. In the example above, this would find any words beginning with "comp."

dir *.mp3
3

A string starting with characters in a parenthesis and ending a greater than tells Find to look for any word ending with whatever is contained in the parentheses. In the example above, this would find any words ending with "er."

Linux and Unix wildcard examples

dir *.mp3
4

This command uses the ls command to list all files and directories in the working directory that begin with the letters "comp" in a Linux variant.

dir *.mp3
5

Deleting files using the rm command in a Linux variant containing c, mp, and any character between.

Microsoft Excel wildcard examples

dir *.mp3
6

Excel formula to search for any character using the * wildcard in cells B1 through B6, and if found, use SUM to add all values between A1 and A6.

What does a wildcard character represent?

To locate a specific item when you can't remember exactly how it is spelled, try using a wildcard character in a query. Wildcards are special characters that can stand in for unknown characters in a text value and are handy for locating multiple items with similar, but not identical data.

What are the symbols that represent any character or combination of character?

Thus, Wildcard(*) are symbols that represent any character or combination of characters.

What is the name of the wildcard character that can represent any combination of characters?

Wildcard Characters.

Which symbol can represent a number of characters in a find and replace wildcard?

The most common wildcards you can use in the Find and Replace dialog box are the asterisk (*) to find multiple characters and the question mark (?) to find a single character.