$var = ereg_replace ("<a([^>]*)href=('|\")([^\"|']*)('|\")([^>]*)>", "<a\\1href=\"http://tudominio.com/?url=\\3\"\\5>", $var);