- preg_replace: documentation ( source)
<?php
echo preg_replace('#href="http://(.*)vbulletin\.com(.*)"#', 'href="http://anonym.to/?http://$1vbulletin.com$2"', '<a href="http://w.vbulletin.com/tst">vB</a>');
echo preg_replace('#href="http://(.*)vbulletin\.com(.*)"#', 'href="http://anonym.to/?http://$1vbulletin.com$2"', '<a href="http://vbulletin.com/test">vB</a>');