Assume we have a string containing a list of customers:
Variable | Value |
---|
string | "Spring Corp.,Summer Ltd.;Autumn & Co.,Winter & Partners" |
Assuming that the split character is either the ",
" or the ";
", you can split this string with the following results:
Regular Expression | Result splittedStringArray |
---|
set splittedStringArray = string.split(",|;"); | ["Spring Corp.", "Summer Ltd.", "Autumn & Co.", "Winter & Partners"] |
set splittedStringArray = string.split("(,|;)"); | ["Spring Corp.", ",", "Summer Ltd.", ";", "Autumn & Co.", " |
Winter & Partners", ";