Comparison operators
The previous section introduces comparison operators that can be used to compare a particular word in the message with another word. These operators permit expressions such as (leftvalue operator rightvalue), returning either true or false.
While the outer parentheses can sometimes be omitted from the comparison expression (depending on where the comparison actually appears in the expression), it is a good practice to include parentheses to promote readability of the expression.
The following operators are available for use with field specifications or global variables:
eq Equal operator—The left value must be precisely equal to the right value, ignoring any letter case.
ne Not equal operator—The left value must be different from the right operator, ignoring any letter case.
lt Numeric less than operator—The left and right values must both be numbers, or begin with numbers. Returns true if the left value is less than the right value. If either the left or the right value is not a number, it is regarded as a numeric zero.
le Numeric less than or equal to operator—Similar to the lt operator, except the comparison is less than or equal to. Both, the left and the right values, must be numbers, or begin with numbers. Returns true if the left value is less than or equal to the right value. If either the left or right values are not numbers, they are regarded as a numeric zero.
gt Numeric greater than operator—The left and right values must both be numbers, or begin with numbers. Returns true if the left value is greater than the right value. If either the left or right values are not numbers, they are regarded as a numeric zero.
ge Numeric greater than or equal to operator—Similar to the gt operator, except the comparison is greater than or equal to. The left and right values must both be numbers, or begin with numbers. Returns true if the left value is greater than or equal to the right value. If either the left or the right value is not a number, it is regarded as a numeric zero.
llt Lexical less than operator—This performs an alphabetical comparison of the left and right values. Returns true if the left value is alphabetically less than the right value, ignoring case.
lle Lexical less than or equal to operator—Similar to the llt operator, except the comparison is alphabetically less than or equal to. Returns true if the left value is alphabetically less than or equal the right value, ignoring case.
lgt Lexical greater than operator—This performs an alphabetical comparison of the left and right values. Returns true if the left value is alphabetically greater than the right value, ignoring the case.
lge Lexical greater than or equal to operator—Similar to the lgt operator, except that the comparison is alphabetically greater than or equal to. Returns true if the left value is alphabetically greater than or equal the right value, ignoring the case.
in Keyword or wildcard match pattern—This operator tests to see if the keyword or wildcard contained in the left value is found in the right value. This is similar to the correlation expressions discussed previously, but is confined to the value contained in the right value.
not in Keyword or wildcard match pattern negation—The same as the in operator, except that the comparison returns true if the left value keyword or wildcard is not in the right value.
Comparison functions allow you to target very specific portions of the target message. As with other expressions, comparisons can be joined together using logical operators to create very specific match patterns.
Related topic