How to remove all attributes from <a>
tag except href="/index.php..."
? and add a custom class to it ?
So this:
<a href="/index.php?option=com_virtuemart&view=cart&Itemid=105&lang=en" style="float:right;">content</a>
Becomes:
<a href="index.php?option=com_virtuemart&view=cart&Itemid=105&lang=en" class="custom">content</a>
i cant manage the preg_replace to work it: `
<?php
$text = '<a href="index.php?option=com_virtuemart&view=cart&Itemid=105&lang=en" class="custom">content</a>';
echo preg_replace("/<a([a-z][a-z0-9]*)(?:[^>]*(\shref=['\"][^'\"]['\"]))?>/i", '<$1$2$3>', $text);
?>