This is the regex pattern I'm using which works fine but only returns one match in the resulting array.
([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)
snippet:
var re = '([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)';
var s = {a:12, b: '[email protected]', c:'[email protected]'};
var x = JSON.stringify(s);
var z = x.match(re);
console.log(z);
> Array ["[email protected]", "[email protected]"]
Expected: Array ["[email protected]", "[email protected]"] I would like an array with just the matched email addresses. I tried a global match by adding a trailing /g but the result I get is null.
/([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/g