Jump to content

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>

 

Link to comment
Share on other sites

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.

Edited by scootstah
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.