是否有string.prototype.matchAll ES5安全替代品?

时间:2019-11-28 18:10:44

标签: javascript regex string-matching ecmascript-5

只是发现许多浏览器版本不支持matchAll

string.prototype.matchAll方法是否有ES5安全替代方法?

const regexp = /(?:\[(.*?)\]\((.*?)\))|([^[]+)/g;
const matchedElements = Array.from(value.matchAll(regexp));

0 个答案:

没有答案