RegexSplit

Category: Script / Strings
Since engine version: 8.0 OC

Description

Splits a string into an array of strings.

Syntax

array RegexSplit(string text, string regex, int flags);

Parameters

text:
String to split in parts.
regex:
Regular expression matching the separator in ECMAScript syntax.
flags:
Bitmask of the following values:
Constant Description
Regex_CaseInsensitive Regular expression is case insensitive.
Regex_FirstOnly Split the string only once.

Example

Log("%v", RegexSplit("Harry!, Sven2 & Maikel", "\\s*[,&]\\s*"));
Splits a list of names, returning ["Harry!", "Sven2", "Maikel"].
See also: RegexMatch, RegexReplace, RegexSearch
Luchs, 2016-09