Repository navigation
fix: use Unicode-aware word boundaries for non-ASCII language detection - #15708
Merged
diegosouzapw merged 3 commits intoOct 7, 2026
Merged
diegosouzapw merged 3 commits into
diegosouzapw merged 3 commits into
Conversation
Replace ASCII-only \b word boundaries with Unicode-aware lookarounds using
(?<![\p{L}\p{N}]) and (?![\p{L}\p{N}]) with 'u' flag to correctly match
words in Cyrillic (Russian) and accented Latin scripts (Italian, Portuguese,
Spanish, French, German, Indonesian).
- Fixes false negatives when non-ASCII words are adjacent to other letters
- Adds 'u' flag to all regex patterns for proper Unicode property escapes
- Maintains same matching logic for ASCII words while extending support to non-ASCII
Refresh onto release/v3.8.52. Hungarian hints use the same lookbehind boundaries, and an ASCII-adjacent fragment does not match. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
merged commit Oct 7, 2026
3b644d6
into
diegosouzapw:release/v3.8.52
7 of 9 checks passed
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
Fixes language detection for non-ASCII scripts by replacing ASCII-only
\bword boundaries with Unicode-aware lookarounds using(?<![\p{L}\p{N}])and(?![\p{L}\p{N}])with theu(Unicode) flag.Problem
JavaScript's
\bword boundary only works with ASCII letters[a-zA-Z0-9_]. This meant:Fix
\bboundaries with Unicode-aware lookarounds:(?<![\p{L}\p{N}])(lookbehind: not preceded by letter/number) and(?![\p{L}\p{N}])(lookahead: not followed by letter/number)uflag to all regexes to enable Unicode property escapesuflag for consistencyAffected languages