Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/05/2010, 14:24
Avatar de mayid
mayid
Colaborador
 
Fecha de Ingreso: marzo-2009
Ubicación: BsAs
Mensajes: 4.014
Antigüedad: 15 años
Puntos: 101
problema de expresiones regulares?

Tengo un texto dividido en tres secciones así:

Cita:
<section>
Modelling, Texturing and Animating a Hand
</section>

<section>
<h3>
<strong>by Julian MacDonald</strong>
</h3>
</section>

<section>
<h2>
<strong class="c3">Adding a Texture</strong>
</h2><br />
<br />
<br />
There are a number of options available for applying a texture to the hand object. For a simplistic, cartoonish look we could go for a uniform texture and that would be technically quite
simple.<br />
<br />
<a class="c1" href="hand_skeleton.html"><span class="arrows fLeft">Previous: Setting up the Skeleton</span></a> <a class="c1" href="hand_animation.html"><span class="arrows fRight">Next: Animating
the Hand</span></a> <a class="c1" href="contents.html"><span class="arrows">Back to Contents</span></a><br />
</section>
Lo estoy queriendo cortar en partes:
Código PHP:
// $patron = '/<section>(.*?)<\/section>/is';
$patron '/<section>((?:(?!section>).)*)<\/section>/isU';

preg_match_all($patron$texto$matchesPREG_SET_ORDER);
                
echo 
count($matches); 
Para muchas paginas que proceso con este script, todo va bien. Pero para la pagina que pongo por ejemplo, solo me reconoce dos partes, siendo que tiene 3 o mas. No veo que pueda ser diferente en este html de los demas html. Pero tengo 3 o 4 pagina que se cortan en la segunda seccion, y la expresion regular no reconoce mas allá de eso. Me doy cuenta por el count() y también porque no me las imprime.

Que puede estar pasando? Todo parece simple y logico!