string-matches

Retrieves all the matches of a regex in a string.

MIT 10 个版本
安装
npm install string-matches
yarn add string-matches
pnpm add string-matches
bun add string-matches
README

stringMatches

Retrieves all the matches of a regex in a string.

Install

npm install string-matches

Usage

import stringMatches from 'string-matches';

// Let's get all the matches of a regex in a string

const str = 'A tidy tiger tied a tighter tie to tidy her tiny tail';
const regex = /tidy/g; // Don't forget the `g` flag, or it won't work

const matches = stringMatches ( str, regex );

console.log ( matches.length ); // => 2

License

MIT © Fabio Spampinato

版本列表
2.0.1 2025-01-20
2.0.0 2022-05-05
1.1.3 2018-12-06
1.1.2 2018-11-11
1.1.1 2018-11-05
1.1.0 2018-10-16
1.0.3 2018-10-16
1.0.2 2018-09-21
1.0.1 2017-03-25
1.0.0 2017-03-25