refine a diff substitution pattern.