From 90e1d97ad7b73b3aa4bd0255128d27784705c0d3 Mon Sep 17 00:00:00 2001 From: hartvig Date: Sun, 12 Jun 2011 12:59:12 -0200 Subject: [PATCH] Performance issue in ResolveUrls, work items 30324 --- umbraco/businesslogic/IO/IOHelper.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/umbraco/businesslogic/IO/IOHelper.cs b/umbraco/businesslogic/IO/IOHelper.cs index db5b1db547..45e185dbc4 100644 --- a/umbraco/businesslogic/IO/IOHelper.cs +++ b/umbraco/businesslogic/IO/IOHelper.cs @@ -49,14 +49,15 @@ namespace umbraco.IO public static string ResolveUrlsFromTextString(string text) { // find all relative urls (ie. urls that contain ~) - string pattern = "(\\S+)=[\"']?(\\W?\\~(?:.(?![\"']?\\s+(?:\\S+)=|[>\"']))+.)[\"']?"; +// string pattern = "(\\S+)=[\"']?(\\W?\\~(?:.(?![\"']?\\s+(?:\\S+)=|[>\"']))+.)[\"']?"; + string pattern = "<.*?\\\"(\\~.*?)\\\""; MatchCollection tags = Regex.Matches(text, pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace); foreach (Match tag in tags) { string url = ""; - if (tag.Groups[2].Success) - url = tag.Groups[2].Value; + if (tag.Groups[1].Success) + url = tag.Groups[1].Value; // The richtext editor inserts a slash in front of the url. That's why we need this little fix // if (url.StartsWith("/"))