aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Plugins
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2023-05-22 22:48:09 +0200
committerBond_009 <bond.009@outlook.com>2023-06-28 17:07:57 +0200
commitb5f0760db8dba96e9edd67d4b9c914cf25c3d26a (patch)
treea60f87f379ddbfe2436d03b3b1a8f48cbc3b7490 /MediaBrowser.Providers/Plugins
parentf954dc5c969ef5654c31bec7a81b0b92b38637ae (diff)
Use RegexGenerator where possible
Diffstat (limited to 'MediaBrowser.Providers/Plugins')
-rw-r--r--MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs
index 516eee758..a7c93ac4c 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbUtils.cs
@@ -11,10 +11,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
/// <summary>
/// Utilities for the TMDb provider.
/// </summary>
- public static class TmdbUtils
+ public static partial class TmdbUtils
{
- private static readonly Regex _nonWords = new(@"[\W_]+", RegexOptions.Compiled);
-
/// <summary>
/// URL of the TMDb instance to use.
/// </summary>
@@ -50,6 +48,9 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
PersonKind.Producer
};
+ [GeneratedRegex(@"[\W_]+")]
+ private static partial Regex NonWordRegex();
+
/// <summary>
/// Cleans the name according to TMDb requirements.
/// </summary>
@@ -58,7 +59,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
public static string CleanName(string name)
{
// TMDb expects a space separated list of words make sure that is the case
- return _nonWords.Replace(name, " ");
+ return NonWordRegex().Replace(name, " ");
}
/// <summary>