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.
(预期:数组[“ [email protected]”,“ [email protected]”]我想要一个仅包含匹配电子邮件地址的数组。)
I tried a global match by adding a trailing /g but the result I get is null.(我通过添加尾随/ g尝试进行全局匹配,但得到的结果为null。)
/([a-zA-Z0-9+._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/g
ask by L P translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…