I tried to change all links in a php string to nofollow etc. before they are posted to the mysql db.
Both lines I tried did not work:
$group_description = preg_replace('/\b<a href="\b/', '<a rel="nofollow" href="/out/out.php?url=', $group_description);
$group_description = str_replace('<a href="', '<a rel="nofollow" href="/out/out.php?url=', $group_description);
Both Result in: <a href="%5C%22http://www.website.net%5C%22">keyword</a>