execall
Find multiple RegExp matches in a string
Last updated 4 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install execall 
SYNC missed versions from official npm registry.

execall

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 execall

Usage

import execAll from 'execall';

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

API

execAll(regexp, string)

Returns an object[] with a match, sub-matches, and index.

regexp

Type: RegExp

Regular expression to match against the string.

string

Type: string

Related

Current Tags

  • 3.0.0                                ...           latest (4 years ago)

3 Versions

  • 3.0.0                                ...           4 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (3)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |