How to remove `//<![CDATA[` and end `//]]>`?
You don't need regex for a static string.
Replace those parts of the texts with nothing:
$string = str_replace("//<![CDATA[","",$string);
$string = str_replace("//]]>","",$string);
The following regex will do it...
$removed = preg_replace('/^\s*\/\/<!\[CDATA\[([\s\S]*)\/\/\]\]>\s*\z/',
'$1',
$scriptText);
CodePad.
If you must...
$s = preg_replace('~//<!\[CDATA\[\s*|\s*//\]\]>~', '', $s);
This will remove the whole line containing each tag without messing up the indentation of the enclosed code.