From ba7a01ddea430a6eec2661e2f9b7714d3719c652 Mon Sep 17 00:00:00 2001 From: Sorunome Date: Sun, 20 Sep 2020 11:24:56 +0200 Subject: [PATCH] fix: emoji regex typo --- lib/src/event.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/event.dart b/lib/src/event.dart index 7807f88..740fe0b 100644 --- a/lib/src/event.dart +++ b/lib/src/event.dart @@ -770,7 +770,7 @@ class Event extends MatrixEvent { // regexes to fetch the number of emotes, including emoji, and if the message consists of only those // to match an emoji we can use the following regex: - // \x{00a9}|\x{00ae}|[\x{2000}-\x{3300}]|\x{d83c}[\x{d000}-\x{dfff}|\x{d83d}[\x{d000}-\x{dfff}]|\x{d83e}[\x{d000}-\x{dfff}] + // \x{00a9}|\x{00ae}|[\x{2000}-\x{3300}]|\x{d83c}[\x{d000}-\x{dfff}]|\x{d83d}[\x{d000}-\x{dfff}]|\x{d83e}[\x{d000}-\x{dfff}] // we need to replace \x{0000} with \u0000, the comment is left in the other format to be able to paste into regex101.com // to see if there is a custom emote, we use the following regex: ]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*> // now we combind the two to have four regexes: @@ -779,19 +779,19 @@ class Event extends MatrixEvent { // 3. count number of emoji // 4- count number of emoji or emotes static final RegExp _onlyEmojiRegex = RegExp( - r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|\s)*$', + r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|\s)*$', caseSensitive: false, multiLine: true); static final RegExp _onlyEmojiEmoteRegex = RegExp( - r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>|\s)*$', + r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>|\s)*$', caseSensitive: false, multiLine: true); static final RegExp _countEmojiRegex = RegExp( - r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])', + r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])', caseSensitive: false, multiLine: true); static final RegExp _countEmojiEmoteRegex = RegExp( - r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>)', + r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>)', caseSensitive: false, multiLine: true);