I want to find /AA/ pattern in AA-AA-AA subject string. I need to get the matching string and the position (index) of the match.
/AA/
AA-AA-AA
I have loo
exec() only returns a single match. To get all matches with a global regexp, you have to call it repeatedly, eg.:
exec()
g
var match, indexes= []; while (match= r.exec(value)) indexes.push([match.index, match.index+match[0].length]);