0

我想在<>标志中选择节点一些文本并更改其颜色...

MatchCollection begin = Regex.Matches(richXmlBox.Text, @"\<\b.*\>\b");

if (begin != null && begin.Count > 0)
{
    foreach (Match m in begin)
    {
        richXmlBox.Select(m.Index, m.Length);
        richXmlBox.SelectionColor = Color.Crimson;
    }
}

例如,这适用于sdfsdf<something>asd

但这不起作用<something><something>

4

0 回答 0