Fix for infinite loop regexp bug in v8 (#2254)