$text = preg_replace("#(^|[\r\n ]|^\])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)(|[\r\n ]|^\[)#si", "\\1\"\" ", $text);