Several built-in, infix operators allow testing for equality and inequality. For numbers, <
, >
, <=
, >=
, ==
, and !=
Anchor
eq
, neq
, and like
are used.Like
takes a regular expression as its second argument and returns true if it matches the string given as its first argument. Arguments to these operators can be any valid expression.
Code Block | ||||
---|---|---|---|---|
| ||||
spicy = cheese like re/(nacho|pepperjack)/; |
The following are all valid predicate expressions:
Code Block | ||||
---|---|---|---|---|
| ||||
c == 5 |
...
page:var("city") eq "Blackfoot" |
...
"Lindon" neq location:city() |
...
weather:curr_temp() < 90 |
...
location:city() + ", WA" eq city |
...
5 * (weather:curr_temp() - 32) / 9 < 0 |
As can be seen from the preceding examples, a number of built-in libraries provide predicates that can be used inside predicate expressions. The documentation for those libraries gives details about their operation.
Compound predicate expressions are created using the operators &&
, ||
, and not
to express conjunction, disjunction, and negation, respectively. Parentheses are used to group expressions for precedence.