Refactor string matcher classes