1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00

Adjusted RegEx pattern to also take special characters into account

This commit is contained in:
tbrose 2021-12-07 02:14:40 +01:00
parent 0a8c4f4cec
commit b6d47a41f4

View File

@ -134,7 +134,7 @@ namespace osu.Game.Online.Chat
{
string fullName = Regex.Escape(username);
string underscoreName = Regex.Escape(username.Replace(' ', '_'));
return new Regex($"\\b({fullName}|{underscoreName})\\b", RegexOptions.IgnoreCase).IsMatch(message);
return new Regex($"(^|^\\W|\\W|\\w\\W)({fullName}|{underscoreName})($|$\\W|\\W|\\w\\W)", RegexOptions.IgnoreCase).IsMatch(message);
}
public class PrivateMessageNotification : OpenChannelNotification