Match GetMatchingPattern(string currentTitle, string selectorPattern)
{
DTE2 dte = DTEService.Get();
Match match = new Regex(
@"^(.*) - (" + dte.Name + ".*) " + Regex.Escape(string.Format("{0} {1}", selectorPattern, "(.*)")) + "$",
RegexOptions.RightToLeft).Match(currentTitle);
if (match.Success)
return match;
match = new Regex(@"^(.*) - (" + dte.Name + @".* \(.+\)) \(.+\)$", RegexOptions.RightToLeft).Match(currentTitle);
if (match.Success)
return match;
match = new Regex(@"^(.*) - (" + dte.Name + ".*)$", RegexOptions.RightToLeft).Match(currentTitle);
if (match.Success)
return match;
match = new Regex(@"^(" + dte.Name + ".*)$", RegexOptions.RightToLeft).Match(currentTitle);
return match;
}