diff --git a/src/components/compose.jsx b/src/components/compose.jsx
index ed06d3e2..20e8869e 100644
--- a/src/components/compose.jsx
+++ b/src/components/compose.jsx
@@ -107,20 +107,20 @@ function countableText(inputText) {
// https://github.com/mastodon/mastodon/blob/c03bd2a238741a012aa4b98dc4902d6cf948ab63/app/models/account.rb#L69
const USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i;
const MENTION_RE = new RegExp(
- `(?$3') // URLs
- .replace(MENTION_RE, '$&') // Mentions
- .replace(HASHTAG_RE, '#$1') // Hashtags
+ .replace(MENTION_RE, '$1$2') // Mentions
+ .replace(HASHTAG_RE, '$1$2') // Hashtags
.replace(
SCAN_RE,
- '$&',
+ '$1$2',
); // Emoji shortcodes
return html + leftoverHTML;