Computer >> Computer tutorials >  >> Programming >> Javascript

How can I remove the (//<![CDATA[ , //]]>) blocks; tags inside a script element in Javascript?


To remove the block inside a <script> element, use the [\s\S]*?:

<script>
   /* <![CDATA[ */
      var A=new Array();
   /* ]]> */
</script>
Demo Text Demo Text
Demo Text
<script type="text/javascript">
   /* <![CDATA[ */
      var B=new Array();
      Demo Text Demo Text
   /* ]]> */
</script>
Demo Text