DotNet.Glob icon indicating copy to clipboard operation
DotNet.Glob copied to clipboard

README fluent builder example is wrong

Open palapapa opened this issue 9 months ago • 0 comments

  var glob = new GlobBuilder()
                .PathSeparator()
                .Literal("foo")
                .AnyCharacter()
                .PathSeparator(PathSeparatorKind.BackwardSlash)
                .Wildcard()
                .OneOf('a', 'b', 'c')
                .NumberNotInRange('1', '3')
                .Literal(".txt")
                .ToGlob();

   var isMatch = glob.IsMatch(@"/fooa\\barrra4.txt"); // returns true.

isMatch is false. The at symbol causes the backslashes to be escaped automatically, so there are two backslashes. Either removing the at symbol or removing one of the backslashes should fix this.

palapapa avatar Sep 10 '23 15:09 palapapa