mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-11 19:31:12 +03:00
15 lines
443 B
C#
15 lines
443 B
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace Content.Shared.Chat.V2.Moderation;
|
|
|
|
public sealed class RegexCensor(Regex censorInstruction) : IChatCensor
|
|
{
|
|
private readonly Regex _censorInstruction = censorInstruction;
|
|
|
|
public bool Censor(string input, out string output, char replaceWith = '*')
|
|
{
|
|
output = _censorInstruction.Replace(input, replaceWith.ToString());
|
|
|
|
return !string.Equals(input, output);
|
|
}
|
|
}
|