match a pattern.