Skip to content

Glob class range spanning / or \ doesn't match it, and the negated class does: [.-0] misses "/", [!A-z] matches "\" #157

Closed

Description

@matt-edmondson

What's wrong

MaskPathSeparators (TextFilter/TextFilter.cs:420-421) replaces every literal / and \ with U+E000. It runs on both the pattern and the text before DotNet.Glob matches them (lines 425 and 529).

A character-class range covers / or \ only implicitly, through its endpoints, so masking never touches it. Once masked, the text holds U+E000, which no ASCII range contains.

Failure scenario

Probed with TextFilter.IsMatch(text, pattern, TextFilterType.Glob, TextFilterMatchOptions.ByWholeString):

Pattern Text Actual Expected
[.-0] (U+002E–U+0030) / false true
[!.-0] / true false
[A-z] (U+0041–U+007A) \ false true
[!A-z] \ true false

Controls behave as expected: [A-z] matches _, and the regex ^v[ -/]1$ matches v/1.

The results are wrong in both directions, with no error. A negated class meant to exclude path characters ends up selecting them.

Relationship to open issues

Suggested fix / acceptance criteria

  • When masking the pattern, give any [...] class whose range spans / or \ the masked character as an extra member. Alternatively, expand ranges that cross a separator before masking.
  • Add tests for each row of the table above, including the negated forms.

Activity

  1. added
    bug
    on Oct 29, 2026
  2. matt-edmondson commented on Oct 29, 2026

    @matt-edmondson
    ContributorAuthor

    Triage


    Generated by Claude Code

  3. added a commit that references this issue on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions