I am doing this in order to change al href= to an # $search='/href=".+?"/sm';$data = preg_replace($search, 'href="#" onclick="seopink();"', $data); now.. the problem is that it will also change things like <link rel="stylesheet" type="text/css" href="#" and it will mess lot's of things... ... so i would like to change $search in order for the script to only search a*href...
$search = '/<a ([^>]*)\bhref="[^"]+"([^>]*)>/'; $data = preg_replace($search, '<a $1href="#" onclick="seopink();"$2>', $data); PHP:
That is the cleanest code, JAY. replace will work best, just keep it clean without too much complexity