split_regex(string, separator)

Uses the given separator to split the given string into a collection of strings. This is the opposite of join().

The default separator is a regular expression which splits the string at any of the following characters:

, ; <whitespace>

The optional second parameter is used as regex. To use a literal string as separator, see split().


Any of these expressions

${split('one two three')}
${split('one::two::three', '::')}
${split('one.two.three', '\\.')}

results in

[one, two, three]


Related Articles
About this article
Last change 2017-05-04
Topics 2.0.2FrontendFunctionsStructr 2.0