5. Working with QBF Operations : QBF Retrieve Operation : Search Qualifications : ? and * Pattern-Matching Characters
 
Share this page                  
? and * Pattern-Matching Characters
Use the question mark (?) to represent one unspecified character. For example, T?P can find the values TAP, TCP, TOP, and so on. You can use more than one question mark to indicate more than one character. For example, to search for all 5‑digit identification codes beginning with 941 enter 941??.
Use the asterisk to represent any number of unspecified characters or no characters at all. For example, to search for all product codes containing the characters ALPHA enter *ALPHA*. This returns answers such as:
122‑STAR‑ALPHA
STAR‑ALPHA‑X4
ALPHA‑987‑PROTO
ALPHA
To search for all product codes that begin with the characters STAR you enter STAR*. This returns answers such as:
STAR‑98‑BETA
STAR‑ALPHA
STAR
You can combine the question mark and the asterisk. For example, to locate any product that begins with four characters and a dash and ends with ALPHA, enter ????‑*ALPHA. This returns answers such as:
STAR‑986‑ALPHA
PROT‑BETA/ALPHA
TEST‑ALPHA
Pattern-matching characters and logical operators interact with each other. For example, you can combine the OR operator and pattern matching characters in a column by entering STAR* or ALPHA‑????. This returns answers such as:
ALPHA‑98G5
ALPHA‑TEST
ALPHA‑5005
STAR‑87‑BETA
STAR‑876‑ALPHA‑X
STAR
For most practical purposes, the AND operator is only useful in numeric fields because it requires that the data in the field meet two separate criteria. Therefore, the AND operator is rarely used in conjunction with pattern-matching characters.
Because QBF treats spaces in search qualifications as an implied AND operator, you must enclose pattern-matching qualifications containing a literal space in quotation marks. For example, in an address field the specification 1776 Adams* returns nothing and does not find 1776 Adams St because the space is treated as an AND operator. To include a space in a character field specification you must enclose the specification in quotation marks. For example, entering 1776 Adams* returns answers such as:
1776 Adams Ln.
1776 Adams St.
1776 Adams Street
1776 Adamstown Court
To use the asterisk or the question mark as actual characters rather than as wild card characters, precede them with the backslash character (\). For example, enter A\*B to look for the actual sequence A*B. If you enter A*B by mistake, QBF searches for any combination of any number of characters that begin with the letter A and end with the letter B.
You cannot use a wild card pattern-matching symbol in conjunction with a greater than (>) or less than (<) comparison operator. For example, >Sm* is not allowed.