Constant literals represent values of the basic types string, integer, real, and Boolean and values of the type regexp.
These expressions simply evaluate to their corresponding values.
For the syntax of regular expressions, see Lexical elements. Regular expressions are enclosed in back quotes (`), as in this example:
`[a-zA-Z]+`
Tuples represent ordered collections of values. These expressions take the form of a parenthesized list of components separated by commas, as in these examples:
(1, true)
("abc", true, -2.0)
String concatenation, comparison, and pattern matching are basic expressions in the form of an infix operator.
The operator + concatenates two strings, as in this example:
"abc" + "def" ⇒ abcdef
The relational operators (=,<> ,<, <=, >, >=) implement lexicographical comparisons of strings, as in these examples:
"abc" = "abd" ⇒ false "abc" <> "abd" ⇒ true "abc" < "abd" ⇒ true
The operators ~= and ~<> compare a string on the left side against a regular expression on the right side for a match or a mismatch. The right side argument to ~= and ~<> must be a string literal rather than a regular expression literal, as in these examples:
"abc" ~= "a*" ⇒ true "abc" ~<> "a*" ⇒ false "10111010110101" ~= "[01]+" ⇒ true "abcdefghijkl" ~= "[^01]+" ⇒ true