refactor wildcard string matcher