Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

string.splitRegex()

Get a list of Strings, using a regex as a delimiter.

Signature

splitRegex(delimiter: String) => Array<String>

Description

The splitRegex() method returns a list of Strings, using the given regex as the delimiter string.

Multiple, adjacent delimiters in the source string result in an empty element in the result list.

The input string isn’t changed.

Parameters

Parameter Type Required Description

delimiter

String

Yes

Delimiter regex expression. Supports Java regex.

Return value

Type Description

Array

Array of strings delimited by delimiter.

Examples

'foo bar baz'.splitRegex('\\W+')
[
  "foo",
  "bar",
  "baz"
]

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!