Find multiple RegExp matches in a string
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.editorconfig init May 31, 2015
.gitattributes init May 31, 2015
.gitignore init May 31, 2015
.jshintrc init May 31, 2015
.travis.yml init May 31, 2015
index.js init May 31, 2015
license init May 31, 2015
package.json update tests for latest AVA version Jan 1, 2016
readme.md Add related section in the readme Jan 5, 2017
test.js update tests for latest AVA version Jan 1, 2016

readme.md

execall Build Status

Find multiple RegExp matches in a string

Instead of having to iterate over RegExp#exec, immutable, and with a nicer result format.

Install

$ npm install --save execall

Usage

var execall = require('execall');

execall(/(\d+)/g, '$200 and $400');
/*
[
	{
		match: '200',
		sub: ['200'],
		index: 1
	},
	{
		match: '400',
		sub: ['400'],
		index: 10
	}
]
*/

API

execall(re, input)

Returns an array of objects with a match, sub-matches, and index.

re

Type: regexp

Regular expression to match against the input.

input

Type: string

Related

License

MIT © Sindre Sorhus