0👍
Does not have anything to do with VueJS then, but with your algorithm, as stated in the comments.
Here is a probably working fix, using a simple variable to store the last value of your regex; not sure it works in all cases but at least for your example, it gives a result.
const regex = /(01)(\d{14}|\d{0})(21)(\d{10}|\d{0})/g;
const str = `01050004560134822100000000091`;
let m, n;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
n = m;
}
console.log(`Group 1: (${n[1]}) ${n[2]} Group 2: (${n[3]}) ${n[4]}`)
Source:stackexchange.com