MATCHES operator
- Last Updated: February 11, 2026
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
Compares a character expression to a pattern and evaluates to a TRUE value if the expression satisfies the pattern criteria.
Syntax
|
- expression
- A CHARACTER or LONGCHAR expression that you want to check to see if it conforms with the pattern.
- pattern
-
A character expression that you want to match with the string. This can include a constant, field name, variable name, or expression whose value is a character.
The pattern can contain wildcard characters: a period (
.) in a particular position indicates that any single character is acceptable in that position; an asterisk (*) indicates that any group of characters is acceptable, including a null group of characters.
Example
This procedure displays customer information for all
Customers whose Address ends in
St. The procedure does not use an index for the Customer
search in r-match.p.
r-match.p
|
Notes
MATCHESdoes not use index information when performing a comparison; it always scans the entire data table.MATCHESdoes not ignore trailing blanks as does the equal (EQ) comparison operator. Thus,"abc"does not match"abc "although they are considered equal.- Most character comparisons are case insensitive in ABL. By default, all
characters are converted to uppercase prior to comparisons. However, you can define fields
and variables as case sensitive (although it is not advised, unless strict ANSI SQL
adherence is required). If the expression preceding the
MATCHESkeyword is a field or variable defined as case sensitive, the comparison is case sensitive. In a case-sensitive comparison"SMITH"does not equal"Smith". MATCHESconverts a LONGCHAR variable value to-cpinternalprior to comparison. The variable must convert without error, or the AVM raises a run-time error.- You cannot use
MATCHESto compare one CLOB field to another. - To specify either an asterisk (
*), as a literal character rather than a wildcard character in the pattern, or a period (.) as a literal character, you must enter a tilde (~) before the character. However, if you specify the match pattern as a literal quoted string in a procedure file, you must enter each tilde as a double tilde (~~). The first tilde escapes the second tilde, so that the AVM interprets the second tilde as a tilde for the match pattern. For example, the result of"*a.b" MATCHES "~~*a~~.b"is TRUE. - The
MATCHESfunction is double-byte enabled. Both the specified expression and pattern arguments can contain double-byte characters. MATCHESdoes not fully support collations for the UTF-8 codepage, if extended characters are involved.- The
MATCHESoperator does not use a collation to compare character expressions by default. However, you can apply collation sensitivity (for UTF-8 codepages only) by using the Collation-Sensitive Operator (-collop) startup parameter.