求帮忙~!
本帖最后由 lisiwen8 于 2012-11-26 15:43:08 编辑 对XML文件的编辑 文本框输入
<?xml version="1.0" encoding="ISO-8859-1"?>
<1><to>George</to><2><from>John</from><heading>Reminder</heading></2><body>Don't forget the meeting!</body></1>
点击编辑后文本框显示:
<?xml version="1.0" encoding="ISO-8859-1"?>
<1>
<to>George</to>
<2>
<from>John</from>
<heading>Reminder</heading>
</2>
<body>Don't forget the meeting!</body>
</1>
<1><2>代表标签
[最优解释]
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = Regex.Replace(textBox1.Text, @"\x20*(</?\d+>
[其他解释]
</[a-zA-Z]+>)", "$1\r\n");
}