Nested parse expressions


Parse expressions can be nested and are evaluated in parenthetical order. There is no practical limit to nesting parse expressions. Any specifications can substitute any parse-spec value with another nested parse-spec value.

The following examples show target strings, parse expressions, and return values:

Target string

Parse expression

Return value

Test1|README.txt

$basename ($delim(pipe, 2))

README

Explanation: The function returns the base name of the second field that is delimited by a pipe.

user account: AA|BB|CC – user account: DD|EE|FF

$skip (user account, 2, $delim (pipe, 2))

EE

Explanation: The function returns the second pipe-delimited word following the second match for user account.

user account: AA|BB|CC – user account: DD|EE|FF

$delim (pipe, $skip (user account, 2, 2))

EE

Explanation: This alternate expression returns the same value as in the preceding example.

test addr: x@y.z

$match (test, $email (addr: *))

 

x@y.z

Explanation: The expression parses the email address only if the keyword test appears in the string.

test addr: x@y.z

$exclude (test, $email (addr: *))

No match

Explanation: The message contains the word test, which is excluded in the expression.

Related topic

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*