From d81d884a01e7355e21eef3e50f5bc9e02b0f53c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 30 Jan 2018 17:16:01 +0900 Subject: [PATCH] Remove unnecessary paren handling from regex Can't find a reason for this to exist --- osu.Game/Online/Chat/MessageFormatter.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs index 855770b953..5a1e866650 100644 --- a/osu.Game/Online/Chat/MessageFormatter.cs +++ b/osu.Game/Online/Chat/MessageFormatter.cs @@ -25,7 +25,6 @@ namespace osu.Game.Online.Chat // This is in the format (, [optional]): // http[s]://.[:port][/path][?query][#fragment] private static readonly Regex advanced_link_regex = new Regex( - @"(?\([^)]*)?" + // protocol @"(?[a-z]*?:\/\/" + // domain + tld @@ -90,20 +89,9 @@ namespace osu.Game.Online.Chat foreach (Match m in regex.Matches(result.Text, startIndex)) { var index = m.Index; - var prefix = m.Groups["paren"].Value; var link = m.Groups["link"].Value; var indexLength = link.Length; - if (!String.IsNullOrEmpty(prefix)) - { - index += prefix.Length; - if (link.EndsWith(")")) - { - indexLength = indexLength - 1; - link = link.Remove(link.Length - 1); - } - } - var details = getLinkDetails(link); result.Links.Add(new Link(link, index, indexLength, details.Action, details.Argument)); }