klyn.regex.RegEx.split
method
public native split(input as String) as Array<String> throws RegExException
Description

Splits the input into an array of substrings using the pattern as a delimiter. Leading and trailing empty fields are retained, including a delimiter at the end of the input, as in RegEx(",").split("a,b,").

Parameters
ParameterDescription
inputThe string to split.
Returns

An array of substrings.

Throws
  • RegExException if the regular expression cannot be evaluated.
Example
regex = RegEx(r"\s+")
results = regex.split("123 abc 456")  # results will be ["123", "abc", "456"]