3.5.3 Operators

The supported operators are arithmetic operators (addition, subtraction, multiplication, division and modulus), logical operators, string operators and field operators.

3.5.3.1 Arithmetic Operators

Arithmetic operators for addition (+), subtraction (-), multiplication (*), integer division (/) and modulus (%) are supported with their usual meanings.

These operators require either numeric operands or string operands whose value can be interpreted as numbers (integer or real).

3.5.3.2 Boolean Operators

The boolean operators and (&&), or (||) and not (!) are supported with the same semantics as their C counterparts.

A compound boolean operator => is also supported in order to ease the elaboration of constraints in records: A => B, which can be read as “A implies B”, translates into !A || (A && B).

The boolean operators expect integer operands, and will try to convert any string operand to an integer value.

3.5.3.3 Comparison Operators

The compare operators less than (<), greater than (>), less than or equal (<=), greater than or equal (>=), equal (=) and unequal (!=) are supported with their usual meaning.

Strings can be compared with the equality operator (=).

The match operator (~) can be used to match a string with a given regular expression (see Regular Expressions).

3.5.3.4 Date Comparison Operators

The compare operators before (<<), after (>>) and same time (==) can be used with fields and strings containing parseable dates.

See Date input formats.

3.5.3.5 Field Operators

Field counters are replaced by the number of occurrences of a field with the given name in the record. For example:

#Email

The previous expression is replaced with the number of fields named Email in the record. It can be zero if the record does not have a field with that name.

3.5.3.6 String Operators

The string concatenation operator (&) can be used to concatenate any number of strings and field values.

'foo' & Name & 'bar'

3.5.3.7 Conditional Operator

The ternary conditional operator can be used to select alternatives based on the value of some expression:

expr1 ? expr2 : expr3

If expr1 evaluates to true (i.e. it is an integer or the string representation of an integer and its value is not zero) then the operator yields expr2. Otherwise it yields expr3.