Please review: Bug: https://bugs.openjdk.java.net/browse/JDK-8164708 Webrev: http://cr.openjdk.java.net/~hannesw/8164708/webrev/ We need to always advance the index of a global replace if previous match string was empty. It seems like this is a spec bug in ES5 that was fixed in ES6. Thanks, Hannes