Fixed duplication of test code glitch.

The RegExp.exec(//gim) -> was searching from the current index,
and then it wrapped and searched again. This would cause the test
command to be read twice. To fix it, I added an object that tracks
which indices have been adjusted already. Before the loop executes,
it checks that variable with the next matched index. If the index is
in the object, it skips it.