diff --git a/pkg/interface/src/logic/lib/tokenizeMessage.js b/pkg/interface/src/logic/lib/tokenizeMessage.js index 39154c6ff0..dc1ffeffc4 100644 --- a/pkg/interface/src/logic/lib/tokenizeMessage.js +++ b/pkg/interface/src/logic/lib/tokenizeMessage.js @@ -52,13 +52,16 @@ const tokenizeMessage = (text) => { } messages.push({ url: str }); message = []; - } else if(urbitOb.isValidPatp(str) && !isInCodeBlock) { + } else if (urbitOb.isValidPatp(str.replace(/[^a-z\-\~]/g, '')) && !isInCodeBlock) { if (message.length > 0) { // If we're in the middle of a message, add it to the stack and reset messages.push({ text: message.join(' ') }); message = []; } - messages.push({ mention: str }); + messages.push({ mention: str.replace(/[^a-z\-\~]/g, '') }); + if (str.replace(/[a-z\-\~]/g, '').length > 0) { + messages.push({ text: str.replace(/[a-z\-\~]/g, '') }); + } message = []; } else {