Get index of each capture in a JavaScript regex
There is currently a proposal (stage 4) to implement this in native Javascript: RegExp Match Indices for ECMAScript ECMAScript RegExp Match Indices provide additional information about the start and end indices of captured substrings relative to the start of the input string. …We propose the adoption of an additional indices property on the array result … Read more