1h ago
Text replacements never match inside sentences in languages written without spaces (Japanese, Chinese, Thai, …)
Since 1.35.0, text replacements match whole words only. In languages written without spaces between words, a word inside a sentence is never a "whole word", so replacements only work when the term is next to punctuation.
My primary language is Japanese, so here is a Japanese example. The same should apply to Chinese, Thai and other languages without spaces. Japanese attaches particles directly to nouns, with no space in between.
Replacement `コンフルエンス → Confluence` (macOS, 2.19.3):
| Transcription | Result |
|---|---|
| コンフルエンス。 ("Confluence.") | ✅ replaced |
| コンフルエンスの記事 ("the Confluence article") | ❌ not replaced |
To an English reader, the second line looks like "theconfluencearticle": there is no boundary around "confluence".
**Proposal:** use Unicode word boundaries (UAX #29) for whole-word matching, e.g. `NSRegularExpression.Options.useUnicodeWordBoundaries`. In my test, this makes the second case match while still not matching inside longer words ("cat" does not match "category").
- https://www.unicode.org/reports/tr29/
- https://developer.apple.com/documentation/foundation/nsregul…
Pending