Next: , Previous: , Up: Selection Expressions   [Contents][Index]

3.5.2 SEX Operands

The supported operands are: numbers, strings, field names and parenthesized expressions. 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:

-3.14 String Literals

String values are delimited by either the ' character or the " character. Whichever delimiter is used, the delimiter closing the literal must be the same as the delimiter used to open it.

Newlines and tabs can be part of a string literal.

Examples are:

'The following example is the empty string.'

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

'This string contains an apostrophe: \'.'
"This one a double quote: \"." 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, to handle the possibility of records with more than one field by that name. Examples:


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 a 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"

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

Email[0] ~ "\\.org"

Will match for:

Name: Mr. Foo

But not for:

Name: Mr. Foo

The regexp syntax supported in selection expressions is POSIX EREs, with several GNU extensions. See Regular Expressions. Parenthesized Expressions

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

Next: , Previous: , Up: Selection Expressions   [Contents][Index]