split()

Splits a string into an array of substrings based on a delimiter.

Syntax

split(STR_EXPR, DELIMITER_EXPR)
Required Parameters
STR_EXPR
Source string expression
DELIMITER_EXPR
String to be used as an array element separator in STR_EXPR. The function separates the strings by using it as separators.

Usage

json "{'url': 'ko.logpresso.com/documents'}" 
| eval array=split(field("url"), "/")
  => ["ko.logpresso.com", "documents"]

json "{}" 
| eval array=split("logpresso", "a")
  => ["logpresso"]

json "{}" 
| eval array=split("a,b,c,d", ",")
  => ["a","b","c","d"]