Fixes #1532 Regexp restarts search from middle of string on multiple iterations, breaking search