I have not been able to find in Stackoverflow advice on finding specific URLs and appending them. I am looking to create "deep links" using a popular affiliate network within HTML content. For example here is some HTML:
<h2>This is a title</h2>
<p>this is some text</p>
<p><a href="https://www.macys.com">link to macys</a></p>
<p><a href="https://www.google.com">link to google</a></p>
<p>something else</p>
</body>
</html>
I want to use Regex to find just the Macys link (not the Google link) in the HTML and append the URLs with the "deep link" code from the affiliate network. So it looks like this:
<html>
<body>
<h2>This is a title</h2>
<p>this is some text</p>
<p><a href="https://click.linksynergy.com/deeplink?id=idnumber&mid=3184&u1=123&murl=http://www.macys.com">link to macys</a></p>
<p><a href="https://www.google.com">link to google</a></p>
<p>something else</p>
</body>
</html>