STRING

Sequence of characters with a specified character set.

LITERAL NOTATION:

1. Quoted string - enclose the string in single quotes. Escape a single quote in the string with a backslash ‘ \ ‘ if needed. Example: specifying format string in TIMESTAMP matcher:

TIMESTAMP('yyyy-MM-dd')

2. Double-quoted string - enclose the string in double quotes. Escape double quote in the string with a backslash ‘ \ ‘ if needed. Note that the string may contain single quotes.

$pattern = "TIMESTAMP:time ' ' LD:message EOL";
  1. heredoc syntax:

    After operator ‘<<<’, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.

1
2
3
4
5
$pattern = <<<EOP
    TIMESTAMP:time
    ' ' LD:message
    EOL
EOP;

Conversion

All SpectX data types can be converted to STRING:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
STRING(BOOLEAN(1))                                  // => "true"
STRING([0,1,2])                                     // => "[0,1,2]"
STRING(BYTES("012"))                                // => "012"
STRING(1d)                                          // => "1.0"
STRING(1f)                                          // => "1.0"
STRING(GEOPOINT(1d,1d))                             // => "1.0,1.0"
STRING(192.168.0.1)                                 // => "192.168.0.1"
STRING(192.168.0.1/20)                              // => "192.168.0.1/20"
STRING(192.168.0.1:22)                              // => "192.168.0.1:22"
STRING(1)                                           // => "1"
STRING(1l)                                          // => "1"
STRING(01-23-45-67-89-ab)                           // => "01-23-45-67-89-ab"
STRING(TIMESTAMP('2019-01-01 00:00:00.000 EET'))    // => "2018-12-31 22:00:00.000 +0000"
STRING({a:1, b:"text"})                             // => "{a=1 b="text"}"
STRING(VARIANT(1))                                  // => "1"
(VARIANT_ARRAY([0,1,2]))                            // => "[0,1,2]"
(VARIANT_OBJECT({a:1, b:"text"}))                   // => "{a=1 b="text"}"

Expressions

1
2
3
4
5
6
7
8
s1="Brown dog jumps over lazy fox"

s1 > "Ay carramba!"
s1 = "Brown dog jumps over lazy fox"
s1 < "brown dog jumps over lazy fox"

s1 || " and crashes to a tree"
s1 + " leaving fox staring"

See also

string functions

Parsing

1
2
3
4
LD:fieldname
DATA:fieldname
[a-zA-Z0-9]:fieldname
UPPER:fieldname