this did not work for me, can you show me what I did wrong in the code:
This is what I have now:
function qa_html_convert_urls($html, $newwindow=false)
/*
Return $html with any URLs converted into links (with nofollow and in a new window if $newwindow)
URL regular expressions can get crazy:
http://internet.ls-la.net/folklore/url-regexpr.html
So this is something quick and dirty that should do the trick in most cases
*/
{
return trim(preg_replace('/([^A-Za-z0-9])((http|https|ftp):\/\/([^\s&<>"\'\.])+\.([^\s&<>"\']|&)+)/i', '\1<A HREF="\2" rel="nofollow"'.($newwindow ? ' target="_blank"' : '').'>\2</A>', ' '.$html.' '));
}
// remove nofollow for my links
$search = '/href="http:\/\/YOURDOMAIN\/([^"]*)" rel="nofollow"/i';
$replace = 'href="http://YOURDOMAIN/\1"';
$html = trim( preg_replace($search, $replace, $html) );
return $html;
This apparently does not work.