Friday, 22 August 2014

Remove text between html close tags C#



In C# i need to remove a text that could appear between 2 specific close XML tags:


So for example i have this text in a string:



</factura>]]></comprobante>


And i need to remove this CDATA close elements but this is just an example and could be other text between this 2 close XML tags.


I need to to it with Regex.


I tried this:



System.Text.RegularExpressions.Regex.Replace(_inputString, @"/(?<=<\/factura>).*?(?=<\/comprobante>)/", "");


But didn't worked.


Thanks in advance. Best regards.


No comments:

Post a Comment