Drastically speed up replacements by remembering next match offsets