Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/08/2009, 10:51
Suyta
(Desactivado)
 
Fecha de Ingreso: septiembre-2004
Mensajes: 360
Antigüedad: 19 años, 7 meses
Puntos: 1
REGEX (palabras completas)

Hola
Este preg_match está fallando
Por qué ?????????????

Código PHP:
<?PHP
$key
="word";
$data="testing2.txt<br>The solutions that are currently available usually involve using binaries such as catdoc or antiword.  Good as these products are, they can be complicated to install and configure (sometimes impossible if using a shared hosting account).Heres a simple attempt at a solution using just PHP.
I dont pretend that it makes a complete success of extracting the text from all Word documents, but Ive found it very reliable for the vast majority of the several thousand docs Ive used it with.
The function returns text from the Word document as a string, with all the formatting removed.
Please note that some parts of the Word document (header, footer etc) are not parsed.
Y, 6Q"
;

if(
preg_match("/\b$key\b/i",$data)){
                                        
$hack=strtolower($data);
                                        
$key=strtolower($key);
                                        
$cnt=substr_count($hack,$key);
                                        
$res_tab.="<td>".$cnt."</td>";
                                    }else{
                                        
$res_tab.="<td>0</td>";
                                    }
                                    echo 
$res_tab;
?>
Word (palabra completa) está tres veces en el texto
Sin embargo obtengo siempre 4... a pesar del modificador "b".
Alguien sabe ?