diff --git a/PKHeX.Core/Legality/Restrictions/WordFilter.cs b/PKHeX.Core/Legality/Restrictions/WordFilter.cs
index 898ae7d00..9c33b993e 100644
--- a/PKHeX.Core/Legality/Restrictions/WordFilter.cs
+++ b/PKHeX.Core/Legality/Restrictions/WordFilter.cs
@@ -14,16 +14,19 @@ public static class WordFilter
/// Regex patterns to check against
///
/// No need to keep the original pattern strings around; the object retrieves this via
- private static readonly Regex[] Regexes = LoadPatterns(Util.GetStringList("badwords"));
+ private static readonly Regex[] Regexes = LoadPatterns(Util.GetStringResource("badwords")!);
// if you're running this as a server and don't mind a few extra seconds of startup, add RegexOptions.Compiled for slightly better checking.
private const RegexOptions Options = RegexOptions.CultureInvariant;
- private static Regex[] LoadPatterns(IReadOnlyList patterns)
+ private static Regex[] LoadPatterns(ReadOnlySpan patterns)
{
- var result = new Regex[patterns.Count];
- for (int i = 0; i < patterns.Count; i++)
- result[i] = new Regex(patterns[i], Options);
+ var lineCount = 1 + patterns.Count('\n');
+ var result = new Regex[lineCount];
+ var enumerator = patterns.EnumerateLines();
+ int i = 0;
+ while (enumerator.MoveNext())
+ result[i++] = new Regex(enumerator.Current.ToString(), Options);
return result;
}