mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 04:03:21 +08:00
Adjusted RegEx pattern to also take special characters into account
This commit is contained in:
parent
0a8c4f4cec
commit
b6d47a41f4
@ -134,7 +134,7 @@ namespace osu.Game.Online.Chat
|
|||||||
{
|
{
|
||||||
string fullName = Regex.Escape(username);
|
string fullName = Regex.Escape(username);
|
||||||
string underscoreName = Regex.Escape(username.Replace(' ', '_'));
|
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
|
public class PrivateMessageNotification : OpenChannelNotification
|
||||||
|
Loading…
Reference in New Issue
Block a user