Repository navigation
fix(grep): UTF-8 codepoint Dot, GNU \b/\B, codepoint-aware -w - #1287
Merged
caomengxuan666 merged 1 commit intoOct 23, 2026
Merged
Conversation
portable_regex matched bytewise so `grep -o 中.` split a multi-byte character, and \\b parsed as a literal b. Dot now consumes a whole UTF-8 sequence, find_first never restarts mid-codepoint, \\b/\\B are GNU word boundaries, and grep -w word checks are codepoint-aware.
Member
|
Thanks — a per-byte |
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.
Summary
Default BRE/ERE local engine matched per byte:
.split CJK;\bparsed as literalb;-wused single-byte word chars.Changes
Dotadvances one codepoint;find_firstdoes not start mid-sequence.WordBoundary/WordBoundaryNotfor\b/\B;\<\>codepoint-aware.-wword_boundary_okcodepoint-aware.Unit tests:
grep_gnu_backslash_b_word_boundary,\B,.whole codepoints,-owalk,-wCJK.Test plan
printf '中文\n' | grep -o '中.'e4b8ade69687(完整「中文」)grep '\balpha\b'grep -o '.'on中文测试-w 中文alpha$,-FNiubash defect log D7 (2026-10-23).