6
2026-01-13 18:31:02 +02:00

16 lines
446 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);
}
}