Use unicode word chars to recognize hashtags in editor (#1296)

This commit is contained in:
Peter-Josef Meisch 2023-03-23 17:31:58 +01:00 committed by GitHub
parent 776a51734f
commit f68e174aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -300,7 +300,7 @@ public class StatusEditorViewModel: NSObject, ObservableObject {
.backgroundColor: UIColor.clear,
.underlineColor: UIColor.clear],
range: NSMakeRange(0, statusText.string.utf16.count))
let hashtagPattern = "(#+[a-zA-Z0-9(_)]{1,})"
let hashtagPattern = "(#+[\\w0-9(_)]{1,})"
let mentionPattern = "(@+[a-zA-Z0-9(_).-]{1,})"
let urlPattern = "(?i)https?://(?:www\\.)?\\S+(?:/|\\b)"