String Comparison Functions
AMPS includes several types of string comparison operators:
Case-Sensitive Exact Matches - The
IN
,=
,BEGINS WITH
,ENDS WITH
, andINSTR
operators do literal matching on the contents of a string. These operators are case-sensitive.Case-Insensitive Exact Matches - AMPS also provides two case-insensitive operators:
INSTR_I
, a case-insensitive version ofINSTR
, and a case-insensitive equality operator,STREQUAL_I
.Regular Expression Matches - AMPS also provides full regular expression matching using the
LIKE
operator, described in Regular Expressions.
The =
operator tests whether a field exactly matches the literal string provided.
BEGINS WITH
and ENDS WITH
test whether a field begins or ends with the literal string provided. The operators return TRUE
or FALSE
.
AMPS allows you to use set comparisons with BEGINS WITH
and ENDS WITH
. In this case, the filter matches if the string in the field begins or ends with any of the strings in the set.
The INSTR
operator allows you to check to see if one string occurs within another string. For this operator, you provide two string values. If the second string occurs within the first string, INSTR
returns the position at which the second string starts, or 0 if the second string does not occur within the first string. Notice that the first character of the string is 1 (not 0). For example, the expression below tests whether the string critical
occurs within the /eventLevels
field.
AMPS also provides INSTR_I
and STREQUAL_I
functions for performing case-insensitive comparisons.
The following table lists the string comparison functions and operators in AMPS:
Last updated