From c0530116112e4cde867f1c1be3497d793b7a5660 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Wed, 22 Nov 2017 16:06:32 +0200 Subject: [PATCH] Make regex in cleanIrcMessage const --- client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js b/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js index f8f18c86..8e4c4a9d 100644 --- a/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js +++ b/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js @@ -1,3 +1,5 @@ "use strict"; -module.exports = (message) => message.replace(/\x02|\x1D|\x1F|\x16|\x0F|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi, "").trim(); +const matchFormatting = /\x02|\x1D|\x1F|\x16|\x0F|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi; + +module.exports = (message) => message.replace(matchFormatting, "").trim();