Refine a substitution pattern.