iOS client for Grain grain.social
ios photography atproto
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: support Unicode characters in hashtag parsing

Hashtag regex only matched ASCII letters, so accented characters like
the á in #Bogotá were excluded. Switch to \p{L} and \p{N} Unicode
classes so hashtags with diacritics, CJK, Cyrillic, etc. are fully
matched and tappable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+2 -2
+1 -1
Grain/Utilities/BlueskyPost.swift
··· 242 242 } 243 243 244 244 // Hashtags (same regex as web) 245 - let hashtagPattern = try! NSRegularExpression(pattern: #"#([a-zA-Z][a-zA-Z0-9_]*)"#) 245 + let hashtagPattern = try! NSRegularExpression(pattern: #"#(\p{L}[\p{L}\p{N}_]*)"#) 246 246 for match in hashtagPattern.matches(in: text, range: NSRange(location: 0, length: nsText.length)) { 247 247 guard let fullRange = Range(match.range, in: text), 248 248 let tagRange = Range(match.range(at: 1), in: text) else { continue }
+1 -1
Grain/Views/Components/RichTextView.swift
··· 117 117 private func segmentsFromRegex(text: String) -> [Segment] { 118 118 let urlPattern = #"https?://[^\s<>\[\]()]+"# 119 119 let mentionPattern = #"@([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?"# 120 - let hashtagPattern = #"#([a-zA-Z][a-zA-Z0-9_]*)"# 120 + let hashtagPattern = #"#(\p{L}[\p{L}\p{N}_]*)"# 121 121 122 122 struct Match { 123 123 let range: Range<String.Index>