Consider spacing when converting string to unicode emote

This commit is contained in:
Jeremy Zhang 2019-03-30 20:55:49 +00:00
parent 6c48efb6c6
commit 44ff83ef17

View File

@ -1878,8 +1878,9 @@
}; };
for (var i in map) { for (var i in map) {
var escaped = i.replace(/([()[{*+.$^\\|?])/g, '\\$1'); var escaped = i.replace(/([()[{*+.$^\\|?])/g, '\\$1');
escaped = "(\\s|^)(" + escaped + ")(\\s|$)";
var regex = new RegExp(escaped, 'gim'); var regex = new RegExp(escaped, 'gim');
input = input.replace(regex, map[i]); input = input.replace(regex, "$1" + map[i] + "$3");
} }
return input; return input;
} }