Closed MarkMichaelis closed 7 years ago
Interesting.. looks like you may have found a bug there. Are you using the latest stable nuget version? If you have time to submit / add a failing test case to the tests project I'd be greatful. I'll take a look as soon as I can.
It appears the issue is with the comma, not just the space:
DotNet.Globbing.Glob.Parse("Stuff,X*").IsMatch("Stuff,Xx")'
: false
Hmm
Does this match (added an extra space)
DotNet.Globbing.Glob.Parse("Stuff,X* ").IsMatch("Stuff,Xx")'`
?
Fortunately, no.
Or this:
DotNet.Globbing.Glob.Parse("Stuff,X*").IsMatch("Stuff,Xx ")'`
My guess (not at pc right now) is that it happens if:
Hence why i'm wondering If making the test string one char longer suddenly matches..
I will get to the bottom of it a bit later!!
Ok I see what is happening here. This is related to #32
When unsupported alpha numeric characters are encountered in the token (comma is one of those i'm afraid) the parsing / tokeniser is skipping past that unsupported character so it's essentially like it's not there in the pattern.
In other words, when you do this:
DotNet.Globbing.Glob.Parse("Stuff,*").IsMatch("Stuff, x");: true
you are actually getting the result of this:
DotNet.Globbing.Glob.Parse("Stuff*").IsMatch("Stuff, x");: true
Because the comma in the pattern is being skipped over.
I need to think about how I address this. The first thing I should do is throw an exception if there is an unsupported character used in a token. If you don't mind I am going to close this in favour of #32
The following results seems to indicate a defect:
DotNet.Globbing.Glob.Parse("Stuff,*").IsMatch("Stuff, x");
: trueDotNet.Globbing.Glob.Parse("Stuff *").IsMatch("Stuff x");
: trueDotNet.Globbing.Glob.Parse("Stuff, *").IsMatch("Stuff, x");
: falseAm I missing something?