标签: javascript regex string-matching ecmascript-5
只是发现许多浏览器版本不支持matchAll。
matchAll
string.prototype.matchAll方法是否有ES5安全替代方法?
string.prototype.matchAll
const regexp = /(?:\[(.*?)\]\((.*?)\))|([^[]+)/g; const matchedElements = Array.from(value.matchAll(regexp));