regexpSplitParts
Description
Splits a string using a regular expression as the delimiter and return the token at the specified index. The index starts at 1, not 0.
Syntax
Like many functions in DataPrime, regexpSplitParts
supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
Name | Type | Required | Description |
---|---|---|---|
value | string | true | The string to split |
delimiter | regexp | true | The regular expression used as the delimiter |
index | number | true | The 1-based index of the token to return |
Example
Extract a value from inconsistently spaced key-value data
Consider the following document:
Use regexpSplitParts
with a whitespace pattern to split the string and return the third token:
Output
Theme
Light