AceInfinity
Emeritus, Contributor
I seen a request by somebody else on another forum for such a thing, someone else posted code that only worked for one replacement, and did not remove the bbcode tags. Here's an example that i've created from this idea to completely format all tags within a full bit of text, and remove the bbcode:
Example:
Code:
foreach (Match match in Regex.Matches(richTextBox1.Text, @"\[b\](.*?)\[/b\]", RegexOptions.IgnoreCase).OfType<Match>().Reverse())
{
richTextBox1.Select(match.Index, match.Length);
Console.WriteLine(match.Groups[0]);
richTextBox1.SelectionFont = new Font("Tahoma", 9, FontStyle.Bold);
richTextBox1.SelectedText = match.Groups[1].Value;
}
Example: