Skip to content

Split a string by delimiters but ignore contents inside parenthesis/brackets

License

Notifications You must be signed in to change notification settings

Badestrand/outer-split

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

outer-split

Split a string by delimiters but ignore contents inside parenthesis/brackets.

Installation

Download node at nodejs.org and install it, if you haven't already.

npm i --save outer-split

This module has no dependencies.

Description

Split a string by characters but ignore those separator characters inside brackets.

Options are

{
    separators: string,     // default ',;'
    empties: true/false,    // default true, keeps empty entries
    trim: true/false        // default false, trims each entry
}

Usage

const splitOuter = require('split-outer')

const text = 'Maude (smart, wise), Harold (funny, talkative); Higgins (France, California);'
const parts = splitOuter(text, {trim: true, empties: false})
// results in
//	[
//		'Maude (smart, wise)',
//		'Harold (funny, talkative)',
//		'Higgins (France, California)'
//	]

License

MIT

About

Split a string by delimiters but ignore contents inside parenthesis/brackets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published