Let glob * and ? match across / and \ [patch] - #119
Merged
Merged
Conversation
DotNet.Glob is a file-path glob, so its wildcards stopped at path separators and any item containing a slash or backslash could not be matched: "*readme*" dropped "docs/readme.md". Both separators are now swapped for a private-use character in the pattern and the text before DotNet.Glob sees them, so they are ordinary characters. Fixes #114 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VKxYoUXQqgRKJR6ynbvnms
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013xQ2dceFuWS8VLEn2xLuZE
|
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #114
What changed
ResolveGlobcompiles tokens with DotNet.Glob. DotNet.Glob matches file paths, so*and?stop at/and\. As a result, no wildcard could match any item that contained a slash or backslash. For example,*readme*droppeddocs/readme.md.This PR takes the issue's second suggested fix. Both separators are replaced with a private-use character (U+E000) in the filter token before
Glob.Parse, and in each text token beforeIsMatch. To DotNet.Glob they are then ordinary characters. The replacement happens in the same place for the pattern and the text, so a literal/in a pattern still matches only a/(or\) in the text. The glob cache, the case-insensitive options and the half-typed-range handling are unchanged.I chose this over replacing DotNet.Glob with a hand-written glob-to-regex translation because it is much smaller. It changes only the three
IsMatchcall sites andResolveGlob. It also leaves the lines touched by #116 and #117 alone, so the three PRs can merge in any order. If you want the regex translation later, it can replace this one.Tests
The five repro tests from the issue are added. There are three more:
/in a pattern still requires a separator in the textWith the change reverted, 7 of the new tests fail; the literal-slash guard passes either way. With the change, the full suite passes: 114 tests, 0 failed.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VKxYoUXQqgRKJR6ynbvnms
Generated by Claude Code