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.