escape patterns for term highlighting