You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regex filters containing a space or \s never match under the default ByWordAny option ("hello world" doesn't match "hello world") #122
DoesMatchRegex (TextFilter/TextFilter.cs ~L452) splits the text into words via ExtractTextTokens for ByWordAny/ByWordAll, then runs the regex against each word separately (~L488-496). The pattern isn't split. Since no single word ever contains whitespace, any regex that must match across whitespace (a literal space, \s, a phrase) can never match. Filter/IsMatch default to TextFilterMatchOptions.ByWordAny, so this is the out-of-the-box behavior.
Failure scenario (verified with a console app against the net10.0 build)
Only ByWholeString matches. In a regex filter box with default options, typing New York or \d+ items hides every item, even though the regex hint says the text must match the pattern.
Suggested fix
Under ByWordAny, also try the pattern against the whole text: regex.IsMatch(text) || tokens.Any(regex.IsMatch). Keeping the per-word check means word-anchored patterns like ^world keep matching. (For ByWordAll the per-word semantics are arguably intended; at minimum document that whitespace-spanning patterns need ByWholeString there.)
Acceptance criteria
IsMatch("hello world", "hello world", TextFilterType.Regex) and IsMatch("hello world", "o\\sw", TextFilterType.Regex) return true under the defaults.
Existing per-word regex tests (e.g. ^world matching "hello world" under ByWordAny) still pass.
Priority: High. ByWordAny is the default for Filter/IsMatch, so any regex that spans whitespace (a literal space, \s, a phrase such as New York) hides every item with default options. The regex filter mode is broken out of the box for a common kind of input.
Area / suggested assignee:TextFilter.DoesMatchRegex and ExtractTextTokens in TextFilter/TextFilter.cs. Owner: @matt-edmondson
Next step: under ByWordAny, try the whole text first (regex.IsMatch(text) || tokens.Any(regex.IsMatch)). For ByWordAll, either keep the per-word semantics and document that whitespace-spanning patterns need ByWholeString, or apply the same fallback. Add the acceptance tests for "hello world" and "o\\sw", plus a check that ^world still matches under ByWordAny.
Activity
matt-edmondson commentedon Sep 27, 2026
Triage
ByWordAnyis the default forFilter/IsMatch, so any regex that spans whitespace (a literal space,\s, a phrase such asNew York) hides every item with default options. The regex filter mode is broken out of the box for a common kind of input.TextFilter.DoesMatchRegexandExtractTextTokensinTextFilter/TextFilter.cs. Owner: @matt-edmondson(?i)) touch the same matcher but don't cover this. It is related to Regex timeout applies per word per item, so one catastrophic-backtracking pattern still freezes Filter() for N seconds (10 items: 10 s) #118: the whole-text evaluation added here must stay under the same timeout budget, so the two fixes would be easiest to land together or in sequence.ByWordAny, try the whole text first (regex.IsMatch(text) || tokens.Any(regex.IsMatch)). ForByWordAll, either keep the per-word semantics and document that whitespace-spanning patterns needByWholeString, or apply the same fallback. Add the acceptance tests for"hello world"and"o\\sw", plus a check that^worldstill matches underByWordAny.Generated by Claude Code