Ver Mensaje Individual
  #6 (permalink)  
Antiguo 15/05/2010, 20:00
Avatar de wiwi74
wiwi74
 
Fecha de Ingreso: marzo-2008
Mensajes: 515
Antigüedad: 16 años, 2 meses
Puntos: 10
Respuesta: problema de expresiones regulares?

Yo lo hice asi y me devuelve "3":



<?

$texto="<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>";

// $patron = '/<section>(.*?)<\/section>/is';
$patron = '/<section>((?:(?!section>).)*)<\/section>/isU';

preg_match_all($patron, $texto, $matches, PREG_SET_ORDER);

echo count($matches);

?>



/* fijate en la pequeña diferencia con el tuyo */
/* fijate de ponerlo con comillas simples a ver que pasa */
/* ya que asi de modo plano, literal , funciono */

Última edición por wiwi74; 15/05/2010 a las 20:07