Adds test for exec presering lastIndex. Closes #491