using System.Text.RegularExpressions;
public static void Main()
string str = "{{printing|blue,bold,http://www.google.com/}} and {{Lorem Ipsum|bold}}";
var formattedString = Regex.Replace(str, @"{{(?<symbol>[^|]+?)\|(?<formats>.+?)}}", m =>
var formatedPattern = m.Groups["formats"].Value.Split(',').Aggregate("{0}", (acc, f) =>
case "bold": return "<b>" + acc + "</b>";
case "red": return "<font color = \"red\">" + acc + "</font>";
case "blue": return "<font color = \"blue\">" + acc + "</font>";
if (Uri.TryCreate(f.ToLower(), UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttp)
return "<a href = \"" + f + "\" target = \"_blank\">" + acc + "</a>";
else if (System.IO.File.Exists(path + f))
string fileName = System.IO.Path.GetFileName(path + f);
return "<a href = \" \\s\\Download\\" + fileName + "\">" + acc + "</a>";
return string.Format(formatedPattern, m.Groups["symbol"].Value);
Console.WriteLine(formattedString);