Split filters and text on all whitespace, not only ' ' - #116
Merged
Merged
Conversation
A chunk of other whitespace (tab, CR/LF, NBSP) between spaces survived RemoveEmptyEntries and then trimmed to an empty token. The glob tokenizer read its first character and threw, and regex ByWordAll saw a phantom empty word, which also undid the blank-text guard from #107. Fixes #112 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZUfnvhMFzj96bfFNzbfpn
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZUfnvhMFzj96bfFNzbfpn
|
matt-edmondson
deleted the
claude/textfilter-112-non-space-whitespace
branch
September 27, 2026 15:06
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 #112
What changed
ExtractTextTokensandExtractGlobFilterTokenssplit on' 'and then trimmed each piece. A piece made only of other whitespace (tab, CR/LF, NBSP) got pastRemoveEmptyEntriesand then trimmed down to"". Both now split on all whitespace withSplit((char[]?)null, RemoveEmptyEntries), so an empty token can't come out of either one.IsMatch/Filterwith a filter like"foo \t"or"foo \r\n"no longer throwsInvalidOperationException."hello \t world"matchesoagain, and text that is only whitespace (" \t ") goes back to matching nothing, which restores the Regex + ByWordAll matches empty or whitespace-only text against any pattern #107 behaviour.Tests
GlobWithNonSpaceWhitespaceDoesNotThrow,RegexByWordAllIgnoresNonSpaceWhitespaceBetweenWordsandRegexByWordAllDoesNotMatchTextOfOnlyNonSpaceWhitespacefailed before the fix (7 failures) and pass after it.#113, the ByWholeString optional-token combinator, is in the same area but will go in its own PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SZUfnvhMFzj96bfFNzbfpn
Generated by Claude Code