fix: emoji regex typo

This commit is contained in:
Sorunome 2020-09-20 11:24:56 +02:00
parent 864cbfa906
commit ba7a01ddea
No known key found for this signature in database
GPG key ID: B19471D07FC9BE9C

View file

@ -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 // 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: // 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 // 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: <img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*> // to see if there is a custom emote, we use the following regex: <img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>
// now we combind the two to have four regexes: // now we combind the two to have four regexes:
@ -779,19 +779,19 @@ class Event extends MatrixEvent {
// 3. count number of emoji // 3. count number of emoji
// 4- count number of emoji or emotes // 4- count number of emoji or emotes
static final RegExp _onlyEmojiRegex = RegExp( 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, caseSensitive: false,
multiLine: true); multiLine: true);
static final RegExp _onlyEmojiEmoteRegex = RegExp( static final RegExp _onlyEmojiEmoteRegex = RegExp(
r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>|\s)*$', r'^(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>|\s)*$',
caseSensitive: false, caseSensitive: false,
multiLine: true); multiLine: true);
static final RegExp _countEmojiRegex = RegExp( 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, caseSensitive: false,
multiLine: true); multiLine: true);
static final RegExp _countEmojiEmoteRegex = RegExp( static final RegExp _countEmojiEmoteRegex = RegExp(
r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>)', r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|<img[^>]+data-mx-(?:emote|emoticon)(?==|>|\s)[^>]*>)',
caseSensitive: false, caseSensitive: false,
multiLine: true); multiLine: true);