一个标签转化成两个标签
转化前:
<lrbc:ContentNoteRun Note="注释" Text="文字" Background="#FFFFC800" Tag="ContentNote" />
转化后:
<Run>文字</Run><Note value="注释"/>
转化前:
<lrbc:ContentNoteRun Note="注释" Text="文字" Background="#FFFFC800" Tag="ContentNote" />
转化后:
<Run>文字</Run><Note value="注释"/>
using System.Text.RegularExpressions; string strhtml = @"<lrbc:ContentNoteRun Note=""注释"" Text=""文字"" Background=""#FFFFC800"" Tag=""ContentNote"" />";
string regpattern = @"(?is)<lrbc:ContentNoteRun[^>]*?Note=""([^""]*?)""[^>]*?Text=""([^""]*?)""[^>]*? />";
string resulthtml = Regex.Replace(strhtml, regpattern, @"<Run>$2</Run><Note value=""$1""/>");