2014-02-12 6 views
-2

Мне нужно заменить: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:</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); 

переменная строка содержит целое xml-файл.

Пожалуйста, помогите. Нужно это плохо.

+0

Кажется, что вам нужно string.replace вместо regex.replace, лучше XML-парсер. –

+0

Можете ли вы показать мне, как использовать замену строки? –

+0

извините. это сработало. –

ответ

0

Это слишком просто. Она нуждается в 2 строковые значения, старый и новый, как указано ниже:

string.Replace(oldValue, newValue) ; 
0

Попробуйте как этот

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

Смежные вопросы