When I run
/(a)/g.exec(\'a a a \').length
I get
2
but I thought it should return
3
Code:
alert('a a a'.match(/(a)/g).length);
Output: