Next: , Up: Selection Expressions


18.1.1 Operands

The supported operands are: numbers, strings, field names and parenthesized expressions.

18.1.1.1 Numeric Literals

The supported numeric literals are integer numbers and real numbers. The usual sign character ‘-’ is used to denote negative values. Integer values can be denoted in base 10, base 16 using the 0x prefix, and base 8 using the 0 prefix. Examples are:

     10000
     0
     0xFF
     -0xa
     012
     -07
     -1342
     .12
     -3.14
18.1.1.2 String Literals

String values are delimited by either the ' character or the " character. Whatever delimiter is used, the delimiter closing the literal shall equal to the delimiter used to open it.

Note that newlines and tabs can be part of a string literal.

Examples are:

     'Hello.'
     'The following example is the empty string.'
     ''

The ' and " characters can be part of a string if they are escaped with a backslash, like in:

     'This string contains an apostrophe: \'.'
     "This one a double quote: \"."
18.1.1.3 Field Values

The value of a field value can be included in a selection expression by writing its name. The field name is replaced by a string containing the field value, covering any possibility with records with more than one field featuring that name. The last colon character (:) of the field name is optional. Examples:

     Name
     Email:
     Hacker:Name:OpenedBy

It is possible to use the role part of a field if it is not empty. So, for example, if we are searching for the issues opened by ‘John Smith’ in a database of issues we could write:

     $ recsel -e "OpenedBy = 'John Smith'"

instead of using the full field name:

     $ recsel -e "Hacker:Name:OpenedBy = 'John Smith'"

When the name of a field appears in an expression, the expression is applied to all the fields in the record featuring that name. So, for example, the expression:

     Email ~ "\\.org"

Will match any record in which there is a field named ‘Email’ whose value terminates in ‘.org’. If we are interested in the value of some specific email, we can specify its relative position into the containing record by using subscripts. Consider, for example:

     Email[0] ~ "\\.org"

Will match for:

     Name: Mr. Foo
     Email: foo@foo.org
     Email: mr.foo@foo.com

But not for:

     Name: Mr. Foo
     Email: mr.foo@foo.com
     Email: foo@foo.org

The regexp flavor supported in selection expressions are the POSIX EREs plus several GNU extensions. See Regular Expressions.

18.1.1.4 Parenthesized Expressions

Parenthesis characters (( and )) can be used to group sub expressions in the usual way.