JS Iterate Match Indexes

const targetText = ''
let reg = /e(.*?)e/g;
let result;

while((result = reg.exec(targetText)) !== null) {
  	// result: ['', '', '', index: 210, input: '[targetText]', groups: undefined]
    doSomethingWith(result);
}
florinrelea