Jump to content
New Reality: Ads For Members ×

Remove Script Tag if Script contains "www.example.com"


rama_ritwik

Recommended Posts

I need regular expression  to remove script tag if script contains "www.example.com". Please help me to find this

 

Ex:

<script type=\"text/javascript\">window.NREUM||(NREUM={});NREUM.info={\"beacon\":\"bam.nr-data.net\"\"applicationID\":\"8016770\",\"queueTime\":0,\"applicationTime\":653,\"atts\":\"H0YEGgNNGUs=\",\"errorBeacon\":\"bam.nr-data.net\",\"agent\":\"www.example.com\"}</script>
 
3. <script type=\"text/javascript\">// <![CDATA[
window.NREUM||(NREUM={});NREUM.info={\"beacon\":\"bam.nr-data.net\",\"applicationID\":\"8016770\",\"queueTime\":0,\"applicationTime\":30,\"atts\":\"H0YEGgNNGUs=\",\"errorBeacon\":\"bam.nr-data.net\",\"agent\":\"www.example.com\"}
// ]]></script>

 

I don't have time to mess with it right now, but my approach would be to strpos() for "www.example.com" and then find the previous <script and next </script> strings from that position. You shouldn't even need regex for this.

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.