I'm stuck as preg_matching is not always that easy as I'm totally not familiar with it.
I'm trying to replace all the
In example:
<a href="www.site1.com">Site1</a> => <a href="http://example.com?u=www.site1.com">Site1</a>
But the <a href can be written in many ways; a HREF or A href or double spaced <A href etc... How can i manage this. Bear in mind, performance is key
I've tried the following with str_replace, but of course that does not cover all the <a href (capital non capitalized versions).
$str = '<a href="www.sitename1.com">sitename1</a><br /><a href="www.sitename2.com">sitename2</a><br /><A HREF="www.sitename3.com">sitename3</a>';
$Replace = str_replace('<a href="', '<a href="https://example.com/&i=1243123&r=', $str);
echo $Replace