diff options
Diffstat (limited to 'webapp/utils')
-rw-r--r-- | webapp/utils/emoticons.jsx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/webapp/utils/emoticons.jsx b/webapp/utils/emoticons.jsx index b13b50a77..8a10e254e 100644 --- a/webapp/utils/emoticons.jsx +++ b/webapp/utils/emoticons.jsx @@ -26,6 +26,8 @@ export const emoticonPatterns = { thumbsdown: /(^|\s)(:-1:)(?=$|\s)/g // :-1: }; +export const EMOJI_PATTERN = /(:([a-zA-Z0-9_-]+):)/g; + export function handleEmoticons(text, tokens, emojis) { let output = text; @@ -49,7 +51,7 @@ export function handleEmoticons(text, tokens, emojis) { } // match named emoticons like :goat: - output = output.replace(/(:([a-zA-Z0-9_-]+):)/g, (fullMatch, matchText, name) => replaceEmoticonWithToken(fullMatch, '', matchText, name)); + output = output.replace(EMOJI_PATTERN, (fullMatch, matchText, name) => replaceEmoticonWithToken(fullMatch, '', matchText, name)); // match text smilies like :D for (const name of Object.keys(emoticonPatterns)) { |