using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(<section[a-z=""'\s]+>([\s\S]*?)<\/section>)";
string substitution = @"$1";
string input = @"<chapter id=""chap1"">
<para0><title></title></para0>
</chapter>
<chapter id=""chap2""> <title>THEORY</title>
<section id=""Thoery"">
<title>theory Section</title>
<para0 verstatus=""ver"">
<title>Theory Para 0 </title>
<text>blah blah</text>
</para0>
</section>
<section id=""Next section"">
<title>title</title>
<para0>
<title>Title</title>
<text>blah blah</text>
</para0>
</section>
<section id=""More sections"">
<title>title</title>
<para0>
<title>Title</title>
<text>blah blah</text>
</para0>
</section>
<section id=""section"">
<title>title</title>
<para0>
<title>Title</title>
<text>blah blah</text>
</para0>
</section>";
RegexOptions options = RegexOptions.Multiline | RegexOptions.IgnoreCase;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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