break out of regex scan loop when match is past cursor