Strings.split()

Split a string into an array of strings using a regular expression.

Usage

Hover over inputs/exits for more info.

var Strings = require('machinepack-strings');


// Split a string into an array of strings using a regular expression.

Strings.split({

string: 'Hello world!',

regexp: '\\s',

caseInsensitive: true,

}).execSync();

Inputs

string required

The string to split.

'Hello world!'
regexp required

The regular expression for detecting delimiters which mark the end of each string segment.

'\\s'
caseInsensitive

Whether or not you care about uppercase/lowercase letters.

true

Exits

error

An unexpected error occurred.

invalidRegexp

Provided regular expression is invalid (cannot be instantiated into a RegExp object)

success

OK.

[ 'Hello' ]