I'm looking for simple and powerful way to implement Windows flavoured *
and ?
wildcards matching in strings.
BeginsWith()
, EndsWith()
too simple to cover all cases, while translating wildcards expressions to regex'es will look to complex and I'm not sure about performance.
A happy medium wanted.
EDIT: I'm trying to parse .gitignore
file and match the same files, as Git does. This means:
- File should be out of repository's index (so I'm checking file's path against one stored in index)
- Number of patterns in
.gitignore
can be large; - Number of files to check might also be large.