similar to wildcard matching, but different, recursively match the string