I want to match a regex like /(a).(b)(c.)d/
with \"aabccde\"
, and get the following information back:
\"a\" at index = 0
\"b\" at i
With RegExp.prototype.exec() and searching the properly indexes of the result:
let regex1 = /([a-z]+):([0-9]+)/g;
let str1 = 'hello:123';
let array1;
let resultArray = []
while ((array1 = regex1.exec(str1)) !== null) {
const quantityFound = (Object.keys(array1).length - 3); // 3 default keys
for (var i = 1; i