I'm trying to remove the CDATA wrapper in the following script (content has to be wrapped by CDATA to pass XHTML validation):
<script id="tplTest" type="text/html">
//<![CDATA[
<p id="msg">Hello</p>
<p>Another test: <#= ddd.ArtID #></p>
//]]>
</script>
JavaScript:
var strTmp = document.getElementById("tplTest").innerHTML;
var strNew = strTmp.replace(/[\/(\/!\[)\]CDATA]/g, "").replace(/[(\/\/\]\])]/g, "");
It removes most to the CDATA mark-up except for the start/end (<, >) tags:
<
<p id="msg">Hello<p>
<p>nother test: <#= ddd.rtI #><p>
>
Question: How should I modify the regex to additionally remove these leading and trailing <, > tags?