fix regexp tp prevent failure if map is at the very end

oh well, the map could also be at the very end, sigh.