Regex Help | Preg_replace is driving me crazy!

FreakenSEOsmh

Power Member
Joined
Jul 31, 2017
Messages
587
Reaction score
401
hello fellow coders. I need help with the following


am trying to use preg_replace to change an existing script on my page
PHP:
<script type="text/javascript">
                var ad_idzone = "888888",
                    ad_width = "728",
                    ad_height = "90";
            </script>
            <script type="text/javascript" src="https://ads.xxx.com/ads.js"></script>
            <noscript><a href="http://main.xxx.com/img-click.php?idzone=8888888" target="_blank"><img src="https://syndication.xxx.com/ads-iframe-display.php?idzone=8888888&output=img&type=728x90" width="728" height="90"></a></noscript>

and then replace it with this

HTML:
<script async src="//adserver.xxx.com/jsbjads.js"></script>
<ins id="88888" data-width="728" data-height="102"></ins>
<script>(ads = window.ads|| []).push({'adzone':88888});</script>


your thoughts on this are much appreciated, cheers :)
 
everytime i go through with it the freaken quotations ruin it for me, help please!
 
I'm kinda confused what exactly are you trying to do. If I understood correctly, this is what you're trying to do:

Your script have the following text in it:
Code:
<script type="text/javascript">
                var ad_idzone = "888888",
                    ad_width = "728",
                    ad_height = "90";
            </script>
            <script type="text/javascript" src="https://ads.xxx.com/ads.js"></script>
            <noscript><a href="http://main.xxx.com/img-click.php?idzone=8888888" target="_blank"><img src="https://syndication.xxx.com/ads-iframe-display.php?idzone=8888888&output=img&type=728x90" width="728" height="90"></a></noscript>

And you want to find the above text and replace all of it with this:
Code:
<script async src="//adserver.xxx.com/jsbjads.js"></script>
<ins id="88888" data-width="728" data-height="102"></ins>
<script>(ads = window.ads|| []).push({'adzone':88888});</script>

Is that correct?
 
Back
Top