The short version:<p><a href="http://stackoverflow.com/questions/1520800/why-regexp-with-global-flag-in-javascript-give-wrong-results" rel="nofollow">http://stackoverflow.com/questions/1520800/why-regexp-with-g...</a>
The statefulness of the combination of the g flag and .exec() cost me several hours a couple of months ago on a necessary upgrade, finding something deep inside a router that had been fine with /g before but which had after changes made the implicit assumption that .exec() was idempotent. Having it work every second time was a little annoying.