From 6ce7a042eae6605d7ca1faee9ccc1394b4bb1bf6 Mon Sep 17 00:00:00 2001 From: top Date: Thu, 10 Aug 2023 12:36:58 +0000 Subject: [PATCH] Update emoji regex (#185) Quick change to double the emoji regex since I've added a shitload of new modifiers that can all be used together Prevented marseys such as :marseytransgenocidegenocidepattalking: from working Co-authored-by: Chuck Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/185 Co-authored-by: top Co-committed-by: top --- files/assets/js/markdown.js | 2 +- files/helpers/regex.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/assets/js/markdown.js b/files/assets/js/markdown.js index 0f72571153..29bd2e0aa8 100644 --- a/files/assets/js/markdown.js +++ b/files/assets/js/markdown.js @@ -154,7 +154,7 @@ function markdown(t) { input = input.replace(/(\n|^)>([^ >][^\n]*)/g, '$1\>$2') input = input.replace(/((\s|^)[0-9]+)\. /g, '$1\\. ') - const emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,36}):(?![^`]*`)/gi)) + const emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,72}):(?![^`]*`)/gi)) if (emojis != null){ for(i = 0; i < emojis.length; i++){ const old = emojis[i][0]; diff --git a/files/helpers/regex.py b/files/helpers/regex.py index ba0d16a656..2c18a8a4c9 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -50,8 +50,8 @@ strikethrough_regex = re.compile('(^|\s|>|")~{1,2}([^~]+)~{1,2}' + NOT_IN_CODE_O mute_regex = re.compile("\/mute @?([\w\-]{3,30}) ([0-9]+)", flags=re.A|re.I) -emoji_regex = re.compile(f"

\s*(:[!#@\w\-]{{1,36}}:\s*)+<\/p>", flags=re.A) -emoji_regex2 = re.compile(f'(?|[^`]*`))', flags=re.A) +emoji_regex = re.compile(f"

\s*(:[!#@\w\-]{{1,72}}:\s*)+<\/p>", flags=re.A) +emoji_regex2 = re.compile(f'(?|[^`]*`))', flags=re.A) snappy_url_regex = re.compile('(.+?)<\/a>', flags=re.A) snappy_youtube_regex = re.compile('