What's wrong
TextFilter.cs:411-413, inside DoesMatchRegex:
RegexOptions regexOptions = caseSensitivity is TextFilterCaseSensitivity.CaseInsensitive
? RegexOptions.Compiled | RegexOptions.IgnoreCase
: RegexOptions.Compiled;
RegexOptions.IgnoreCase without RegexOptions.CultureInvariant folds case using the current thread culture, not an invariant/ordinal fold. Under a Turkish culture (tr-TR), uppercase I and lowercase i are not case-equivalent (the dotted/dotless I problem: i folds to İ, not I).
Concrete failure scenario
CultureInfo.CurrentCulture = new CultureInfo("tr-TR");
new Regex("i", RegexOptions.IgnoreCase).IsMatch("I"); // False
new Regex("I", RegexOptions.IgnoreCase).IsMatch("i"); // False
// same pattern with RegexOptions.CultureInvariant added -> True
So TextFilter.DoesMatchRegex("IMG_1234.JPG", "img", opts, TextFilterCaseSensitivity.CaseInsensitive) returns a different answer depending on the calling thread's CurrentCulture — a silent, hard-to-reproduce bug for any app whose UI thread runs under a Turkish locale (not an exotic case). This is a live gap in newly-added code: the case-insensitive matching feature was added in commit 7b59874 (closing #97), and neither the README's "Case Sensitivity" section nor the tests around TextFilterTests.cs:582-625 mention or test culture, so this isn't a documented/intentional limitation.
The glob path (DotNet.Glob's CaseInsensitive option, used in ResolveGlob) does not have this problem — it matches correctly regardless of culture. The bug is isolated to the regex branch.
Suggested fix
Add RegexOptions.CultureInvariant alongside RegexOptions.IgnoreCase at line 412:
RegexOptions regexOptions = caseSensitivity is TextFilterCaseSensitivity.CaseInsensitive
? RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant
: RegexOptions.Compiled;
Add a regression test that sets CurrentCulture to tr-TR (or uses CultureInfo.InvariantCulture vs tr-TR explicitly) and asserts img matches IMG_1234.JPG case-insensitively regardless of culture.
What's wrong
TextFilter.cs:411-413, insideDoesMatchRegex:RegexOptions.IgnoreCasewithoutRegexOptions.CultureInvariantfolds case using the current thread culture, not an invariant/ordinal fold. Under a Turkish culture (tr-TR), uppercaseIand lowercaseiare not case-equivalent (the dotted/dotless I problem:ifolds toİ, notI).Concrete failure scenario
So
TextFilter.DoesMatchRegex("IMG_1234.JPG", "img", opts, TextFilterCaseSensitivity.CaseInsensitive)returns a different answer depending on the calling thread'sCurrentCulture— a silent, hard-to-reproduce bug for any app whose UI thread runs under a Turkish locale (not an exotic case). This is a live gap in newly-added code: the case-insensitive matching feature was added in commit7b59874(closing #97), and neither the README's "Case Sensitivity" section nor the tests aroundTextFilterTests.cs:582-625mention or test culture, so this isn't a documented/intentional limitation.The glob path (
DotNet.Glob'sCaseInsensitiveoption, used inResolveGlob) does not have this problem — it matches correctly regardless of culture. The bug is isolated to the regex branch.Suggested fix
Add
RegexOptions.CultureInvariantalongsideRegexOptions.IgnoreCaseat line 412:Add a regression test that sets
CurrentCulturetotr-TR(or usesCultureInfo.InvariantCulturevstr-TRexplicitly) and assertsimgmatchesIMG_1234.JPGcase-insensitively regardless of culture.