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