The regular expression object
The string to perform the operation on
A generator that yields an object for each match.
If the provided regex is not a RegExp instance.
const regex = /(?<g1>a)/g
const str = 'Anthony wants a girlfriend.'
console.log([...rexec(regex, str)])
// [
// {
// index: 9,
// lastIndex: 10,
// groups: { g1: 'a' },
// match: 'a',
// },
// {
// index: 14,
// lastIndex: 15,
// groups: { g1: 'a' },
// match: 'a',
// },
// ]
Generated using TypeDoc
Easily perform regex 'exec' on a string. An iterable is returned which steps through the exec process and yields all the details you might need.