From b8814a8bd598ab42b11232bf8bcd86a58a7a929d Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Fri, 4 Jul 2025 10:35:11 +0530 Subject: [PATCH] fix: Escape closing bracket in mention regex (#11877) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Summary** - Fixed Ruby warning about unescaped closing bracket in character class within `MENTION_REGEX` - Properly escaped the `]` character in the regex pattern to follow Ruby regex syntax standards **Changes** - Updated `MENTION_REGEX` in `lib/regex_helper.rb` to escape the closing bracket in character class `[^]]+` → `[^\\]]+` --- lib/regex_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/regex_helper.rb b/lib/regex_helper.rb index 5e4c2abf0..2eeb895ea 100644 --- a/lib/regex_helper.rb +++ b/lib/regex_helper.rb @@ -11,7 +11,7 @@ module RegexHelper # Uses [^]]+ to match any characters except ] in display name to support emojis # NOTE: Still used by Slack integration (lib/integrations/slack/send_on_slack_service.rb) # while notifications use CommonMarker for better markdown processing - MENTION_REGEX = Regexp.new('\[(@[^]]+)\]\(mention://(?:user|team)/\d+/([^)]+)\)') + MENTION_REGEX = Regexp.new('\[(@[^\\]]+)\]\(mention://(?:user|team)/\d+/([^)]+)\)') TWILIO_CHANNEL_SMS_REGEX = Regexp.new('^\+\d{1,15}\z') TWILIO_CHANNEL_WHATSAPP_REGEX = Regexp.new('^whatsapp:\+\d{1,15}\z')