Closed PeAb closed 7 years ago
Thanks for reporting. The algortihms for IsMatch and Match are slightly different. Basically because Match() attempts to get additional information and so it does additional analysis, where as IsMatch() always attempts to fail fast if things don't match. I'll need to check if this is a problem just for Match() or if it also effects IsMatch. I'll add a couple of tests cases for this.
Ok, this is fixed in latest build I have extended the tests a bit, and included this as a regression test. Latest nuget package if you want to re-test is: https://www.nuget.org/packages/DotNet.Glob/1.5.0-unstable0014
Thanks
Thanks, that fixed it. Although in the testcase below:
Glob glob = Glob.Parse(@"/DIR1/ab*d.txt"); string s = @"/DIR1/ab.txt"; bool isMatch = glob.IsMatch(s); Console.Out.WriteLine("isMatch = {0}", isMatch); MatchInfo matchInfo = glob.Match(s); Console.Out.WriteLine("matchInfo.Success = {0}", matchInfo.Success);
The results are: glob.IsMatch(s) works and returns False ...but glob.Match(s) generates a System.IndexOutOfRangeException
Ok thanks, I'll add that to the test cases and will fix that shortly.
Just wondering, do you actually need Match() as opposed to IsMatch() ?
I ask because I'm tempted to drop this method until it can be written in a way that ensure it behaves identically to IsMatch.
I really only use IsMatch() currently.
Closing this, will open a new issue to get rid of Match().
Code example:
gives: matchInfo.Success = False