Ver Mensaje Individual
  #3 (permalink)  
Antiguo 12/11/2011, 20:18
Asfo
 
Fecha de Ingreso: octubre-2009
Mensajes: 25
Antigüedad: 15 años, 5 meses
Puntos: 5
Respuesta: Problemas con preg_replace()

Muchas gracias GatorV ;) ya lo logré arreglar :).
Dejo el código arreglado por si a alguien le sirve en algún momento:

Código PHP:
public static function toLink($text)
    {
        
$text html_entity_decode($text);
        
$text " ".$text;
        
$text preg_replace('/(((f|ht){1}tp:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i','\\1'$text);
        
$text preg_replace('/(((f|ht){1}tps:\/\/)[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i','\\1'$text);
        
$text preg_replace('/([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&\/\/=]+)/i','\\1\\2'$text);
        
$text preg_replace('/([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})/i','\\1'$text);
            return 
$text;
    }