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

42 lines
871 B
Markdown

---
title: regexp.splitRegexp() function
description: >
The `regexp.splitRegexp()` function splits a string into substrings separated by
regular expression matches and returns an array of `i` substrings between matches.
menu:
v2_0_ref:
name: regexp.splitRegexp
parent: Regular expressions
weight: 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_
```js
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_