diff --git a/routes/_utils/replaceEmoji.js b/routes/_utils/replaceEmoji.js index a76df3f..12df946 100644 --- a/routes/_utils/replaceEmoji.js +++ b/routes/_utils/replaceEmoji.js @@ -8,7 +8,8 @@ export function replaceEmoji (string, replacer) { let emojiRegex = getEmojiRegex() function safeReplacer (substring) { - if (substring.match(/^[0-9]+$/)) { // for some reason, emoji-regex matches digits + // emoji regex matches digits and pound sign https://git.io/fpl6J + if (substring.match(/^[0-9#]+$/)) { return substring } return replacer(substring) diff --git a/tests/unit/test-emoji.js b/tests/unit/test-emoji.js index 3d6a35f..fc7152b 100644 --- a/tests/unit/test-emoji.js +++ b/tests/unit/test-emoji.js @@ -60,11 +60,11 @@ describe('test-emoji.js', function () { ) }) - it('does not replace digits', function () { + it('does not replace digits or pound', function () { let replacer = _ => `
${_}
` assert.strictEqual( - replaceEmoji(`it's over 9000`, replacer), - `it's over 9000` + replaceEmoji(`it's over #9000`, replacer), + `it's over #9000` ) })