Retrieves all the matches of a regex in a string.
npm install --save string-matches
import stringMatches from 'string-matches';
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
stringMatches ( str, regex ).length; // 2
- string-replace-all - Replaces all the occurrences of a string into a string with another string.
MIT © Fabio Spampinato