Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Regex Replace不替换以下内容_C#_Xml_Regex - Fatal编程技术网

C# Regex Replace不替换以下内容

C# Regex Replace不替换以下内容,c#,xml,regex,C#,Xml,Regex,我需要替换: string full = <para number="3.">Rule 33.12 of the Federal Court Rules 2011(“FCR”) regulates the practice and procedure to be followed with respect to appeals from the Tribunal. It relevantly provides:</

我需要替换:

string full = <para number="3.">Rule 33.12 of the Federal Court Rules 2011(“FCR”) regulates the practice and procedure to be followed with respect to appeals from the Tribunal. It relevantly provides:</para><item>(2) The notice of appeal must state: </item><item>(a) the part of the decision the applicant appeals from or contends should be varied; and </item><item>(b) the precise question or questions of law to be raised on the appeal; and </item><item>(c) any findings of fact that the Court is asked to make; and </item><item>(d) the relief sought instead of the decision appealed from, or the variation of the decision that is sought; and </item><item>(e) briefly but specifically, the grounds relied on in support of the relief or variation sought. </item><item>Note: The Court can only make findings of fact in limited circumstances—see section 44(7) of the AAT Act. </item><para number="4.">
为此:

string full = <para number="3.">Rule 33.12 of the Federal Court Rules 2011 (“FCR”) regulates the practice and procedure to be followed with respect to appeals from the Tribunal. It relevantly provides:<quote><para>(2) The notice of appeal must state: <list><item>(a) the part of the decision the applicant appeals from or contends should be varied; and </item><item>(b) the precise question or questions of law to be raised on the appeal; and </item><item>(c) any findings of fact that the Court is asked to make; and </item><item>(d) the relief sought instead of the decision appealed from, or the variation of the decision that is sought; and </item><item>(e) briefly but specifically, the grounds relied on in support of the relief or variation sought. </item><item>Note: The Court can only make findings of fact in limited circumstances—see section 44(7) of the AAT Act. </item></list></quote></para><para number="4.">
我使用以下代码:

line = Regex.Replace(line, full, fullNew);
line变量包含整个xml文件


请帮忙。我非常需要这个。请

这太容易了。它需要2个字符串值,旧的和新的,如下所述:

 string.Replace(oldValue, newValue) ;
像这样试试

String line = "Whole xml";

string full = "<para number="3.">Rule 33.12 of the Federal Court Rules 2011(“FCR”) regulates the practice and procedure to be followed with respect to appeals from the Tribunal. It relevantly provides:</para><item>(2) The notice of appeal must state: </item><item>(a) the part of the decision the applicant appeals from or contends should be varied; and </item><item>(b) the precise question or questions of law to be raised on the appeal; and </item><item>(c) any findings of fact that the Court is asked to make; and </item><item>(d) the relief sought instead of the decision appealed from, or the variation of the decision that is sought; and </item><item>(e) briefly but specifically, the grounds relied on in support of the relief or variation sought. </item><item>Note: The Court can only make findings of fact in limited circumstances—see section 44(7) of the AAT Act. </item><para number="4.">"

string fullnew = "<para number="3.">Rule 33.12 of the Federal Court Rules 2011 (“FCR”) regulates the practice and procedure to be followed with respect to appeals from the Tribunal. It relevantly provides:<quote><para>(2) The notice of appeal must state: <list><item>(a) the part of the decision the applicant appeals from or contends should be varied; and </item><item>(b) the precise question or questions of law to be raised on the appeal; and </item><item>(c) any findings of fact that the Court is asked to make; and </item><item>(d) the relief sought instead of the decision appealed from, or the variation of the decision that is sought; and </item><item>(e) briefly but specifically, the grounds relied on in support of the relief or variation sought. </item><item>Note: The Court can only make findings of fact in limited circumstances—see section 44(7) of the AAT Act. </item></list></quote></para><para number="4.">"

line.Replace(full,fullnew)

似乎您需要string.replace而不是regex.replace,这是一个更好的xml解析器。您能告诉我如何使用string replace吗?