Jag har denna för formatering av kod
[red]
private static string QuickTag(string TextToParse, string OpenTag, string CloseTag, string ReplacedOpenTag, string ReplacedCloseTag)
{
string t = TextToParse;
t = Regex.Replace(t, @"\["+OpenTag+@"\]((.|\s)*?)\["+CloseTag+@"\]", ReplacedOpenTag+"${1}"+ReplacedCloseTag, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
return t;
}
[/red]
Och sen använder jag den så här:
[red]
string abc;
abc = QuickTag(abc, "b", "/b", "<b>", "</b>");
[/red]
Mv icaaq