LIKE, MATCHES, MATCHING |
![]() ![]() ![]() |
The LIKE selection clause operator compares a field or evaluated expression against another field, evaluated expression or literal value and tests for the first item matching the pattern template given by the second. The synonyms LIKE, MATCHES and MATCHING can be used.
Format
field LIKE {NO.CASE} template
where
The LIKE selection clause operator returns true if field matches template.
The LIKE operator treats characters that do not correspond to any valid component of a pattern as literal values which must be matched exactly. Thus it is possible to find all the QMBasic include records (which have a suffix of .H) in the BP file by a command of the form
SELECT BP WITH @ID LIKE ....H
The initial three dots are a valid template component. The remaining two characters are not and are hence treated as literals. It would be better to enter this as
SELECT BP WITH @ID LIKE "...'.H'"
to avoid confusion. In some cases quotes must be used to handle literal values which are also valid components of a pattern template.
Example
LIST STOCK WITH PRODUCT.CODE LIKE A...
This command lists items found on the STOCK file with a PRODUCT.CODE starting with A.
See also: |