The asterisk (*), question mark (?), number sign (#), exclamation point (!), hyphen (-), and brackets ([ ]) are wildcard characters. You can use these characters in queries and expressions to include all records, file names, or other items that begin with specific characters or match a certain pattern.
Symbol | Usage | Example |
* | Matches any number of characters, and can be used anywhere in the character string | wh* finds what, white, and why
*at finds cat, bat, and what |
? | Matches any single character | b?ll finds ball, bell, and bill |
# | Matches any single digit | 1#3 finds 103, 113, 123 |
[ ] | Matches any single character within the brackets | b[ae]ll finds ball and bell but not bill |
! | Matches any character not in the list | b[!ae]ll finds bill and bull but not bell or ball |
- | Matches any one of a range of characters | b[a-c]d finds bad, bbd, and bcd |
Note The wildcard characters * (asterisk), ? (question mark), # (number sign), and [ (opening bracket) can match themselves only if enclosed in brackets.
The following table shows how you can use wildcard characters to test expressions for different patterns.
Kind of match |
Pattern |
Match (returns True) |
No match (returns False) |
Multiple characters | a*a | aa, aBa, aBBBa | aBC |
*ab* | abc, AABB, Xab | aZb, bac | |
Special character | a[*]a | a*a | aaa |
Multiple characters | ab* | abcdefg, abc | cab, aab |
Single character | a?a | aaa, a3a, aBa | aBBBa |
Single digit | a#a | a0a, a1a, a2a | aaa, a10a |
Range of characters | [a-z] | f, p, j | 2, & |
Outside a range | [!a-z] | 9, &, % | b, a |
Not a digit | [!0-9] | A, a, &, ~ | 0, 1, 9 |
Combined | a[!b-m]# | An9, az0, a99 | abc, aj0 |