1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:02:55 +08:00

Fixes using Matches+Count instead of IsMatch negatively affecting performance

This commit is contained in:
tbrose 2021-12-07 01:41:21 +01:00
parent f02e44d552
commit 7a0d4fca17

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).Matches(message).Count > 0;
return new Regex($"\\b({fullName}|{underscoreName})\\b", RegexOptions.IgnoreCase).IsMatch(message);
}
public class PrivateMessageNotification : OpenChannelNotification