Just found out that matchAll
is not supported by many browser versions.
Is there an ES5 safe alternative for the string.prototype.matchAll
method?
const regexp = /(?:\[(.*?)\]\((.*?)\))|([^[]+)/g;
const matchedElements = Array.from(value.matchAll(regexp));