I am trying to search through a variable and add a tracking code infront of it. For example this below is saved in database and set to variable $result['block1']
<div class="actnbtns"><a class="btn btn-primary btn-block" href="https://www.landroverusa.com/experiences/lr-experience-drives/index.html">Land Rover Experience Drives</a>
<a class="btn btn-primary btn-block" href="https://www.landroverusa.com/build-your-own/index.html">BUILD YOUR OWN LAND ROVER</a>
</div>
I am wanting to prepend https://myurl.com/trackingcode?ref= to all hrefs in the block to track click-throughs. The code would look like below
<div class="actnbtns"><a class="btn btn-primary btn-block" href="https://myurl.com/trackingcode?ref=https://www.landroverusa.com/experiences/lr-experience-drives/index.html">Land Rover Experience Drives</a>
<a class="btn btn-primary btn-block" href="https://myurl.com/trackingcode?ref=https://www.landroverusa.com/build-your-own/index.html">BUILD YOUR OWN LAND ROVER</a>
</div>
I'm just using LandRover as an example, this could be any URL. Thanks for your help in advance.