From 0a4f8ffead5937680a28cc81e120bcf6f3c57403 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Thu, 6 Jul 2017 18:11:46 +0100 Subject: [PATCH] Alter EMOJI_REGEX to include end of string ($) Fixes https://github.com/vector-im/riot-web/issues/4529 because the match must include the remainder of the query. --- src/autocomplete/EmojiProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autocomplete/EmojiProvider.js b/src/autocomplete/EmojiProvider.js index 5cb3c4af2f..35e9cc7b68 100644 --- a/src/autocomplete/EmojiProvider.js +++ b/src/autocomplete/EmojiProvider.js @@ -41,7 +41,7 @@ const CATEGORY_ORDER = [ ]; // Match for ":wink:" or ascii-style ";-)" provided by emojione -const EMOJI_REGEX = new RegExp('(' + asciiRegexp + '|:\\w*:?)', 'g'); +const EMOJI_REGEX = new RegExp('(' + asciiRegexp + '|:\\w*:?)$', 'g'); const EMOJI_SHORTNAMES = Object.keys(EmojiData).map((key) => EmojiData[key]).sort( (a, b) => { if (a.category === b.category) {