Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
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.
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);
The match-all package is similar to execall in that it also finds all matches of a regular expression in a string. However, it returns an iterator of matches instead of an array. This can be more efficient for large strings or when you only need to process matches one by one.
This package is a polyfill for the String.prototype.matchAll method, which is now part of the standard JavaScript library. It provides functionality similar to execall by returning an iterator of all results matching a string against a regular expression. The main difference is that matchAll is a method on the String prototype, while execall is a standalone function.
Find multiple RegExp matches in a string
Instead of having to iterate over RegExp#exec
, immutable, and with a nicer result format.
$ npm install execall
import execAll from 'execall';
execAll(/(\d+)/g, '$200 and $400');
/*
[
{
match: '200',
subMatches: ['200'],
index: 1
},
{
match: '400',
subMatches: ['400'],
index: 10
}
]
*/
Returns an object[]
with a match, sub-matches, and index.
Type: RegExp
Regular expression to match against the string
.
Type: string
FAQs
Find multiple RegExp matches in a string
The npm package execall receives a total of 1,385,419 weekly downloads. As such, execall popularity was classified as popular.
We found that execall demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.