diff --git a/CubicBot.Telegram/Stats/TwoTripleThree.cs b/CubicBot.Telegram/Stats/TwoTripleThree.cs
index a218a34..56f405f 100644
--- a/CubicBot.Telegram/Stats/TwoTripleThree.cs
+++ b/CubicBot.Telegram/Stats/TwoTripleThree.cs
@@ -1,25 +1,25 @@
using CubicBot.Telegram.Utils;
-using System;
using System.Numerics;
+using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace CubicBot.Telegram.Stats;
-public sealed class TwoTripleThree : IStatsCollector
+public sealed partial class TwoTripleThree : IStatsCollector
{
- private const string TwoDoubleThree = "233";
+ [GeneratedRegex("^233+|233+$")]
+ private static partial Regex LeadingAndTrailingTwoDoubleThreeRegex();
///
- /// Checks whether the message starts with or ends with "233".
+ /// Checks whether the message starts with or ends with the pattern "233+".
///
/// The text message to check.
///
- /// True if the message starts with or ends with "233".
+ /// True if the message starts with or ends with the pattern "233+".
/// Otherwise, false.
///
- private static bool ContainsTwoDoubleThree(ReadOnlySpan msg) => msg.Length >= TwoDoubleThree.Length &&
- (msg[..TwoDoubleThree.Length] == TwoDoubleThree || msg[(msg.Length - TwoDoubleThree.Length)..] == TwoDoubleThree);
+ private static bool ContainsTwoDoubleThree(string msg) => LeadingAndTrailingTwoDoubleThreeRegex().IsMatch(msg);
public Task CollectAsync(MessageContext messageContext, CancellationToken cancellationToken = default)
{