From 60177bfc51be6e4f930401e96aa9ac91c283a3c4 Mon Sep 17 00:00:00 2001 From: olorin99 Date: Wed, 2 Sep 2026 12:59:32 +1000 Subject: [PATCH] Require whitespace or start of line before mention --- lib/src/widgets/markdown/markdown_mention.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/widgets/markdown/markdown_mention.dart b/lib/src/widgets/markdown/markdown_mention.dart index ad009d24..90ce4fae 100644 --- a/lib/src/widgets/markdown/markdown_mention.dart +++ b/lib/src/widgets/markdown/markdown_mention.dart @@ -38,7 +38,7 @@ class MentionMarkdownSyntax extends md.InlineSyntax { @jwr1 */ static const String _mentionPattern = - r'(?:(?:(?:https?:\/\/)?([a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,}))?\/([umc])\/@?|(@|!))([a-zA-Z0-9_]+)(?:@([a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,}))?'; + r'(?:^|\s)(?:(?:(?:https?:\/\/)?([a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,}))?\/([umc])\/@?|(@|!))([a-zA-Z0-9_]+)(?:@([a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z]{2,}))?'; /* Should match the following patterns: