using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\[CDATA\[([^\]]+)(?![\s\S]*\[CDATA)";
string input = @"<?xml version='1.0' encoding='UTF-8'?>
<partial-response><changes><update id=""layout:layoutLeft:treeForm:riverTree"">
<![CDATA[<li id=""layout:layoutLeft:treeForm:flussgebieteBaum:0_0_0"" data-rowkey=""0_0_0""
class=""ui-treenode ui-treenode-parent river default"" role=""treeitem"">
<span class=""ui-treenode-content ui-tree-selectable"" aria-expanded=""false"" aria-selected=""false"">
<span class=""ui-tree-toggler ui-icon ui-icon-triangle-1-e""></span><span></span>
<span class=""ui-treenode-label ui-corner-all""><span title=""W"">W</span></span>
<span class=""hwims-markingSpan""></span></span><ul class=""ui-treenode-children"" style=""display:none"">
</ul></li>]]></update><update id=""javax.faces.ViewState"">
<![CDATA[5518082394550102028:7288540440023391844]]></update></changes></partial-response>";
foreach (Match m in Regex.Matches(input, pattern))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx