I am working on templating system. I do have input of html document from user which contains html tags and javascript codes.
i am fine with html tags. I would only like to match all the javascript codes and add it to array for loading it at the bottom of page.
i tried finding script tag content using preg_match bot not working. my code:
$strPattern = "/<script>[^(<\/script>)]<\/script>/i";
preg_match_all( $strPattern, $strReturn, $arrMatches);
echo 'matches---';
var_dump( $arrMatches );
$strReturn = preg_replace($strPattern, '', $strReturn);
What am i missing?