diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js
index a712f509630..cfec9805308 100644
--- a/addons/mail/static/src/models/composer/composer.js
+++ b/addons/mail/static/src/models/composer/composer.js
@@ -510,7 +510,7 @@ function factory(dependencies) {
* @returns {mail.partner[]}
*/
_computeMentionedPartners() {
- const inputMentions = this.textInputContent.replace(/\n/g, "\n ").match(
+ const inputMentions = this.textInputContent.replace(/\n/g, " \n ").match(
new RegExp("@[^ ]+(?= | |$)", 'g')
) || [];
const unmentionedPartners = [];
@@ -533,7 +533,7 @@ function factory(dependencies) {
* @returns {mail.partner[]}
*/
_computeMentionedChannels() {
- const inputMentions = this.textInputContent.replace('\n', "\n ").match(
+ const inputMentions = this.textInputContent.replace(/\n/g, " \n ").match(
new RegExp("#[^ ]+(?= | |$)", 'g')
) || [];
const unmentionedChannels = [];
@@ -580,7 +580,7 @@ function factory(dependencies) {
if (this.mentionedPartners.length === 0 && this.mentionedChannels.length === 0) {
return body;
}
- const inputMentions = body.replace(new RegExp('
', 'g'), "
")
+ const inputMentions = body.replace(new RegExp('
', 'g'), "
")
.match(new RegExp("(@|#)" + '[^ ]+(?= | |$)', 'g'))
.filter(match => !match.endsWith("
"));
const substrings = [];