Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/02/2012, 08:30
Avatar de Vergara
Vergara
 
Fecha de Ingreso: junio-2010
Ubicación: San Francisco California
Mensajes: 249
Antigüedad: 13 años, 11 meses
Puntos: 6
Respuesta: Filtrar links, expresiones regulares

Bueno, me autorespondo, seria de la siguiente manera:



Código PHP:
Ver original
  1. function detectar_link_especifico($text){
  2. $reg_exUrl = "/\/(nombredelsitio)\/[a-zA-Z0-9_\-\/[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,4}(\/\S*)?/";
  3. if(preg_match_all($reg_exUrl, $text, $url)) {$linkready=preg_replace($reg_exUrl, '<a href="'.$url.'"  TARGET="_blank" rel="nofollow">'.$url.'</a>', $text);
  4. return  print_r($url);
  5. }}



nota: solo detectaria links como este: http://www.forosdelweb.com/123wer/dfsdfwe.html