JSFiddle - React, Tailwind, and code Playground
JavaScript
function rxGroups(rx, str) {
var matches = new Array();
match = rx.exec(str);
while (match != null) {
matches.push(match[1]);
match = rx.exec(str);
}
return matches;
}
var x = rxGroups(
/\((.+?)\)/ig,
"Key (email)=([email protected]) already exists"
);
alert(x.join('\n'));