exec()
only returns a single match. To get all matches with a g
?lobal regexp, you have to call it repeatedly, eg.:
var match, indexes= [];
while (match= r.exec(value))
indexes.push([match.index, match.index+match[0].length]);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…