Skip to content

Commit

Permalink
fix: update regex to include apostrophes in MentionedUserFormatter
Browse files Browse the repository at this point in the history
- Adjust the regular expression in the `format` method to correctly match mentions followed by an apostrophe, ensuring that names like "77Y's" are highlighted as expected.
  • Loading branch information
RamonAsuncion committed Mar 23, 2024
1 parent bd902d9 commit a3e6bc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion assets/chat/js/formatters/MentionedUserFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default class MentionedUserFormatter {
if (message && message.mentioned && message.mentioned.length > 0) {
return str.replace(
new RegExp(
`((?:^|\\s)@?)(${message.mentioned.join('|')})(?=$|\\s|[.?!,])`,
`((?:^|\\s)@?)(${message.mentioned.join('|')})(?=$|\\s|[.?!,'])`,
'igm',
),
`$1<span class="chat-user">$2</span>`,
Expand Down

0 comments on commit a3e6bc6

Please sign in to comment.