diff --git a/bitchat/Services/MessageFormattingEngine.swift b/bitchat/Services/MessageFormattingEngine.swift index 1578f16b..220f83b2 100644 --- a/bitchat/Services/MessageFormattingEngine.swift +++ b/bitchat/Services/MessageFormattingEngine.swift @@ -41,7 +41,9 @@ final class MessageFormattingEngine { enum Patterns { static let hashtag = SafeRegex.compile("#([a-zA-Z0-9_]+)") - static let mention = SafeRegex.compile("@([\\p{L}0-9_]+(?:#[a-fA-F0-9]{4})?)") + // Include \p{M} so NFD nicknames (base letter + combining mark) still + // parse as one mention token; NFC forms are covered by \p{L} alone. + static let mention = SafeRegex.compile("@([\\p{L}\\p{M}0-9_]+(?:#[a-fA-F0-9]{4})?)") /// Trailing partial `@nickname` at the composer cursor — autocomplete only. static let mentionAutocomplete = SafeRegex.compile("@([\\p{L}0-9_]*)$")