Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/02/2012, 07:11
Avatar de repara2
repara2
 
Fecha de Ingreso: septiembre-2010
Ubicación: München
Mensajes: 2.445
Antigüedad: 13 años, 7 meses
Puntos: 331
Respuesta: preg_match busqueda con comodin!

Código PHP:
Ver original
  1. $string[] = '<span class="UNO">';
  2. $string[] = '<span class="2">';
  3. $string[] = '<span class="tres">';
  4. $string[] = '<span class="kk">';
  5.  
  6. echo "<pre>";
  7. foreach($string as $str)
  8. {
  9.     $result = preg_match("/<span class=\"(\d.)\"/", $str, $matches);
  10.     if($result)
  11.     {
  12.         echo htmlentities($str)." contiene:<br>";
  13.         print_r($matches);
  14.         echo "<br>";
  15.     }
  16.     else echo htmlentities($str)." no contiene números.<br>";
  17.  
  18. }
  19. echo "</pre>";

Saludos!
__________________
Fere libenter homines, id quod volunt, credunt.