$token (parse-spec) function


Return the value produced by parse-spec as a single word, where the result of the parse-spec value has all spaces substituted with a _ (underscore) character. This makes a single space delimited word out of a series of words, useful when using functions such as $delim(), $concat(), and $message(), when a single word output of these functions is required. If the parse-spec returns a single word value, then this function simply passes back the value and performs no other action. 

Note

This is the default behavior of the $maplist() function, that has an implicit $token() function wrapping around the input parse specification, so that the results of that parse specification can match the first column of a list.

This function might be useful with the CPars.exe command line utility, or for any special cases where a single word is required (as opposed to multiple words), but otherwise has limited use.

Target string

Parse expression

Return value

This is a test

 

$token(

$delim(eol, 1))

This_is_a_test

The $delim() function parses all words (delimited by the end of line). The result has underscores.

 

Test - DBID: 100 - OBID: 200 - Test

$token( $concat(dbid: *, obid: *))

100_200

The $token() function parses dbid and obid values. The result has underscores.

My user: Bill xxx

$token(user: *)

Bill

The $token() function is replaced by the parsed value without modification.

Related topic

 

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