use Minimatch class to improve perf, fixes #29; fix RegExp handling