a better solution for match_str