Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Several built-in, infix operators allow testing for equality and inequality. For numbers, <, >, <=, >=, ==, and != are used. For strings, eq, neq, and like are used.

The following are all valid predicate expressions:

Code Block
themeConfluence
languagejavascript
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.

Like

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.

...

Info

Note that when the like operator is used inside a JSONPath expression, the second operand--representing the regular expression--is given as a string. '/(nacho|pepperjack)/'

Membership

The following are all valid predicate expressions:There is an infix operator for testing membership, ><. The >< operator tests the number or string in the right operand for membership in the map or array given by the left operand. 

Code Block
themeConfluence
languagejavascript
ca == [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

...

, 6, 7];
m = {"a" : 1, "b" : 2};
a >< 6     // returns true
a >< 3     // returns false
m >< "a"   // returns true
m >< "foo" // returns false

Compound Predicates

Compound predicate expressions are created using the operators &&, ||, and not to express conjunction, disjunction, and negation, respectively. Conjunction has precedence over disjunction. Parentheses are used to group expressions for precedence.

Code Block
themeConfluence
languagejavascript
not a
a && b
a || b
(a || b ) && not c