diff --git a/public/script.js b/public/script.js index 5df017fe6..00af8459c 100644 --- a/public/script.js +++ b/public/script.js @@ -2400,7 +2400,7 @@ function cleanUpMessage(getMessage, isImpersonate) { // trailing invisible whitespace before every newlines, on a multiline string // "trailing whitespace on newlines \nevery line of the string \n?sample text" -> // "trailing whitespace on newlines\nevery line of the string\nsample text" - getMessage = getMessage.replace(/\s+$/gm, ""); + getMessage = getMessage.replace(/[^\S\r\n]+$/gm, ""); if (is_pygmalion) { getMessage = getMessage.replace(//g, name1); getMessage = getMessage.replace(//g, name2);