dazinator / DotNet.Glob

A fast globbing library for .NET / .NETStandard applications. Outperforms Regex.
MIT License
363 stars 27 forks source link

** Directory wildcard not matching correctly #13

Closed dazinator closed 7 years ago

dazinator commented 7 years ago

At the moment /**/some.* doesn't match /some.txt due to the fact that the / is matching, and then the directory wildcard ** is matching from position 1 with subtokens that match /some. against text from position 1 which is some.txt. /some. doesn't match some.txt.

This all boils down to the fact that token needs to also know if it has a trailing / so that I can omit a / token for the trailing slash in its place. That way rather than the glob `//` being tokenised into

it can be tokenised into just:

This will result in the trailing slash in / being omitted as token, so then //some.* will match /some.txt.

/*/some. will not however match some.txt as the first / still expects to match as it is a path separator token. I think this is ok, as to match "some.txt" in any directory you could use **/some.txt and then this wont require a leading slash. .