# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/<section[a-z="'\s]+>([\s\S]*?)<\\/section>/$1/gmi;t' <<< "<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>"
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 SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html