Re: preg_match ;(

From: Date: Mon, 08 Jul 2002 08:46:20 +0000
Subject: Re: preg_match ;(
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-24650@lists.php.net to get a copy of this message
deberias anadir esto para leer el archivi en la variable $contents que luego puedes pasarla a la funcion preg_match_all (manual en ingles): $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); DBI ----- Original Message ----- From: "Cesar J. Iglesias" <ciglesias@aluar.com.ar> To: <lista@phpes.com> Sent: Friday, July 05, 2002 10:14 PM Subject: [PHP-ES] preg_match ;( > Hola amigos, mil gracias por las respuestas, estoy intentando utilizar la > funcion preg_match_all que me paso DBI, pero no logro nada > > Esto es: > > <? > { > $id = fopen("datos.txt", "r"); > preg_match_all( '|fecha=(.*?)\nnombre=(.*?)\n|mi', $id, > $match,PREG_SET_ORDER); > } > echo "Esto es todo: ".$match[0][0]."<br><br>"; > echo "Fecha: ".$match[0][1]."<br>"; > echo "Nombre: ".$match[0][2]; > ?> > > Tambien probe esto > > <? > { > $id = fopen("datos.txt", "r"); > $id2 = fgets($id, 4096); > preg_match_all( '|fecha=(.*?)\nnombre=(.*?)\n|mi', $id2, > $match,PREG_SET_ORDER); > } > echo "Esto es todo: ".$match[0][0]."<br><br>"; > echo "Fecha: ".$match[0][1]."<br>"; > echo "Nombre: ".$match[0][2]; > ?> > > > el texto es asi(texto.txt): > > ----------------------------------- > fecha=03/07/2002 > nombre=javier > > ---------------------------------- (Estas lineas no estan, las dibuje para > el mail) > > La pagina me trae los "echo" que pongo sin los $match.... > > -------------------------- > Esto es todo: > > Fecha: > Nombre: > ------------------------ > > Agradeceria cualquier ayuda sobre este tema, que me parece interesante pero > en el manual lo explica igual que como está aca pero no funciona. > > Javier Iglesias > > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > via news: news://news.phpes.com/ > Manual PHP en español: http://www.php.net/manual/es/ > Para dar de baja la suscripción, mande un mensaje a: > lista-unsubscribe@phpes.com >

« previous php.general.es (#24650) next »