a almost correct solution for wildcard matching.