PhixFlow Help

split



Function: split()

Splits a string where a separator occurs, returning a list of substrings.

Syntax

split(string, separator)

ArgumentTypeDescription
stringStringString to be split
separatorRegular ExpressionRegular expression representing the breakpoints in string where the splits should occur

To return an empty string, specify an empty or null-valued argument.

The separator is expressed as a regular expression. This means that you can use any pattern that can be expressed as a regular expression as a separator. But it also means that you must escape any special characters of regular expressions if you are using these as plain text (e.g. you must use "\\|" to use | as a separator). See examples below.


Examples

split("",",")  or  split(_NULL,",")

returns

[ ]

split("one,two,three",",")

returns

["one","two","three"]

split("one::two::three","::")

returns

["one","two","three"]


split("one::two::","::")

returns

["one","two",""]


split("::::","::")

returns

["","",""]

split("field1|field2|field3","\\|")

returns

["field1","field2","field3"]


This expression will split the string at any single digit between 0 and 9:

split("some text1more text3final text","[0-9]")

returns

["some text","more text","final text"]

See Also

Please let us know if we could improve this page feedback@phixflow.com