docs-v2/content/v2.0/reference/flux/functions/regexp/splitregexp.md

871 B

title description menu weight
regexp.splitRegexp() function The `regexp.splitRegexp()` function splits a string into substrings separated by regular expression matches and returns an array of `i` substrings between matches.
v2_0_ref
name parent
regexp.splitRegexp Regular expressions
301

The regexp.splitRegexp() function splits a string into substrings separated by regular expression matches and returns an array of i substrings between matches.

Output data type: Array of Strings

import "regexp"

regexp.splitRegexp(r: /a*/, v: "abaabaccadaaae", i: 5)

// Returns ["", "b", "b", "c", "cadaaae"]

Parameters

r

The regular expression used to search v.

Data type: Regexp

v

The string value to search.

Data type: String

i

The number of substrings to return.

Data type: Integer