split text(text a, regex b, list name c, trim text d)


Splits a text a into elements using a regular expression. Split elements are added to a named list. The result of the function is the number of elements being added to the list. Already existing elements in the list are not removed.

A regular expression with groups leads to the adding of the values within the groups. If no groups are present, the regular expression is considered to be the separator and all split values are added.

Description of Parameters

a

Text to be split.

b

Regular expression.

c

Name of the list. Default: default

d

(optional) true if leading and trailing spaces should be removed from the elements before being added to the list. Default: false.

Examples

Each example is considered to run with empty lists.

Parameter a

Parameter b

Parameter c

Parameter d

Result

Values in List after Split

abc

,


1

default: {abc}

abc,def;ghi

[,;]

mylist

3

mylist: {abc,def,ghi}

abc , def ; ghi

[,;]

mylist

3

mylist: { abc , def , ghi }

abc , def ; ghi

[,;]

mylist

true

3

mylist: {abc,def,ghi}

12a45c890

(\d{2,3})\D{1}(\d{2,3})\D{1}(\d{2,3})

mylist

3

mylist: {12,45,890}