jjk2 Posted March 31, 2009 Share Posted March 31, 2009 <script type="text/javascript"> var so = new SWFObject('player.swf','mpl','535','422','9'); so.addParam('allowscriptaccess','always'); so.addParam('allowfullscreen','true'); so.addParam('flashvars','file.xml'); so.write('player'); </script> so how can i search for addParam, but automatically end up with the entire <script> </script> ? so i search for addParam, and then automatically it looks up until it gets to <script>. and looks down, until it gets to </script> Link to comment https://forums.phpfreaks.com/topic/151853-how-to-detect-texts-before-and-after/ Share on other sites More sharing options...
fanfavorite Posted March 31, 2009 Share Posted March 31, 2009 I would do it a different way. Search for all the script tags and then search within the script tags for addParam. preg_match_all("/<script(.*)<\/script>/Uis", $somedata, $scriptarray); foreach ($scriptarray[0] as $script) { if (strpos($script) === true) { echo "This script tag has addParam"; } } Link to comment https://forums.phpfreaks.com/topic/151853-how-to-detect-texts-before-and-after/#findComment-797531 Share on other sites More sharing options...
jjk2 Posted March 31, 2009 Author Share Posted March 31, 2009 yes i am awware of that....however poorly formed javascript causes clipping...it will not properly catch the java script tag ending... this is why i am wondering how i can go about searching above and below a target string. Link to comment https://forums.phpfreaks.com/topic/151853-how-to-detect-texts-before-and-after/#findComment-797536 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.