diff options
| author | Bond-009 <bond.009@outlook.com> | 2023-07-06 19:56:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-06 19:56:00 +0200 |
| commit | b95fa294c9e896349c528c032508b9c714c13395 (patch) | |
| tree | 7b85758236caae303e54814f6a13051a3218b60e /MediaBrowser.Common | |
| parent | fb9412b65a569f06364ba77841a287c23d142f73 (diff) | |
| parent | 83d6f21fd021c66ab3b1f6501ecdfd016fee540f (diff) | |
Merge pull request #9799 from Bond-009/genregex
Diffstat (limited to 'MediaBrowser.Common')
| -rw-r--r-- | MediaBrowser.Common/Extensions/BaseExtensions.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/MediaBrowser.Common/Extensions/BaseExtensions.cs b/MediaBrowser.Common/Extensions/BaseExtensions.cs index e3775021e..3615b662b 100644 --- a/MediaBrowser.Common/Extensions/BaseExtensions.cs +++ b/MediaBrowser.Common/Extensions/BaseExtensions.cs @@ -8,20 +8,19 @@ namespace MediaBrowser.Common.Extensions /// <summary> /// Class BaseExtensions. /// </summary> - public static class BaseExtensions + public static partial class BaseExtensions { + // http://stackoverflow.com/questions/1349023/how-can-i-strip-html-from-text-in-net + [GeneratedRegex(@"<(.|\n)*?>")] + private static partial Regex StripHtmlRegex(); + /// <summary> /// Strips the HTML. /// </summary> /// <param name="htmlString">The HTML string.</param> /// <returns><see cref="string" />.</returns> public static string StripHtml(this string htmlString) - { - // http://stackoverflow.com/questions/1349023/how-can-i-strip-html-from-text-in-net - const string Pattern = @"<(.|\n)*?>"; - - return Regex.Replace(htmlString, Pattern, string.Empty).Trim(); - } + => StripHtmlRegex().Replace(htmlString, string.Empty).Trim(); /// <summary> /// Gets the Md5. |
