diff --git a/src/Orchard.Web/Modules/Orchard.MediaProcessing/Filters/MediaProcessingHtmlFilter.cs b/src/Orchard.Web/Modules/Orchard.MediaProcessing/Filters/MediaProcessingHtmlFilter.cs
index bee36e6d9..7a0ef75ba 100644
--- a/src/Orchard.Web/Modules/Orchard.MediaProcessing/Filters/MediaProcessingHtmlFilter.cs
+++ b/src/Orchard.Web/Modules/Orchard.MediaProcessing/Filters/MediaProcessingHtmlFilter.cs
@@ -22,6 +22,7 @@ namespace Orchard.MediaProcessing.Filters {
private readonly IImageProfileManager _profileManager;
private MediaHtmlFilterSettingsPart _settingsPart;
+ private static readonly Regex _imageTagRegex = new Regex(@"
]*>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Dictionary _validExtensions = new Dictionary {
{ ".jpeg", "jpg" }, // For example: .jpeg supports compression (quality), format to 'jpg'.
{ ".jpg", "jpg" },
@@ -52,7 +53,7 @@ namespace Orchard.MediaProcessing.Filters {
return text;
}
- var matches = Regex.Matches(text, @"
]*>");
+ var matches = _imageTagRegex.Matches(text);
if (matches.Count == 0) {
return text;