Socket
Socket
Sign inDemoInstall

execall

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

execall

Find multiple RegExp matches in a string


Version published
Maintainers
1
Weekly downloads
1,610,900
decreased by-9.7%

Weekly downloads

Package description

What is execall?

The execall npm package is used to execute a regular expression against a string and return an array of matches, each with the matched text and index. It is particularly useful when you need to find all occurrences of a pattern in a string, not just the first one.

What are execall's main functionalities?

Finding multiple matches

This feature allows you to find all matches of a regular expression in a string. The example code searches for all occurrences of one or more digits in the given text and logs the array of match objects.

const execall = require('execall');
const regex = /\d+/g;
const matches = execall(regex, 'There are 3 apples and 5 oranges.');
console.log(matches);

Other packages similar to execall

Readme

Source

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

  • replace-string - Replace all substring matches in a string

Keywords

FAQs

Last updated on 08 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc