Let's say I have the following string:
<?php
$str = 'To subscribe go to <a href="http://foo.com/subscribe">Here</a>';
?>
What I'm trying to do is find the URLS within the string that have a specific domain name, "foo.com" for this example, then append the url.
What I want to accomplish:
<?php
$str = 'To subscribe go to <a href="http://foo.com/subscribe?package=2">Here</a>';
?>
If the domain name in the urls isn't foo.com, I don't want them to be appended.