docs-v2/content/flux/v0.x/stdlib/regexp/splitregexp.md

1.1 KiB

title description aliases menu weight introduced
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.
/influxdb/v2.0/reference/flux/functions/regexp/splitregexp/
/influxdb/v2.0/reference/flux/stdlib/regexp/splitregexp/
/influxdb/cloud/reference/flux/stdlib/regexp/splitregexp/
flux_0_x_ref
name parent
regexp.splitRegexp regexp
301 0.33.7

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.

v

The string value to search.

i

The maximum number of substrings to return. -1 returns all matching substrings.