Fix offsets in regex match