Hi,
I have a webblog, which is simple text. However, I include a lot of links to Amazon products, for more information on stuff I mention.
I would like to use some sort of RegEx to change Amazon links to include my Amazon Associate id.
So:
$mytext = '<p>This is <A HREF="http://www.amazon.com/exec/obidos/ASIN/0679781587">link</A> bla bla bla bla bla bla bla.<br>This is a <a href="http://www.google.com">normal link</a>, and should not be changed. And here is another, bla bla bla bla bla bla bla<a href="http://www.amazon.com/exec/obidos/ASIN/0316763721">2nd link</a>. Bla bla bla bla.</p>';
would thus become:
$mytext = '<p>This is <A HREF="http://www.amazon.com/exec/obidos/ASIN/0679781587/MY-AMAZON-ID">link</A> bla bla bla bla bla bla bla.<br>This is a <a href="http://www.google.com">normal link</a>, and should not be changed. And here is another, bla bla bla bla bla bla bla<a href="http://www.amazon.com/exec/obidos/ASIN/0316763721/MY-AMAZON-ID">2nd link</a>. Bla bla bla bla.</p>';
However, I have tried a number of things, but am not able to get this done. Hope someone out there can help.
Cheers!
Regards
Mirthe