¿Múltiples coincidencias dentro de un grupo de expresiones regulares?

Necesito hacer coincidir todas las 'etiquetas' (por ejemplo,% thisIsATag%) que ocurren dentro de los atributos XML. (Nota: tengo la garantía de recibir un XML válido, por lo que no es necesario usar el recorrido completo de DOM). Mi expresión regular está funcionando, excepto cuando haydos etiquetas en un solo atributo, solo se devuelve el último.

En otras palabras, esta expresión regular debe encontrar tag1, tag2, ..., tag6. Sin embargo, omite tag2 y tag5.

Aquí hay un pequeño y divertido arnés de prueba para ti (PHP):

<?php

$xml = <<<XML
<data>
 <slideshow width="625" height="250">

  <screen delay="%tag1%">
   <text x="30%" y="50%" animatefromx="800">
    <line fontsize="32" fontstyle="bold" text="Screen One!%tag2% %tag3%"/>
   </text>
  </screen>

  <screen delay='%tag4%'>
   <text x="30%" y="50%" animatefromx="800">
    <line fontsize='32' fontstyle='bold' text='Screen 2!%tag5%%tag6%'/>
   </text>
  </screen>

  <screen>
   <text x="30%" y="50%" animatefromx="800">
    <line fontsize="32" fontstyle="bold"  text="Screen Tres!"/>
   </text>
  </screen>

  <screen>
   <text x="30%" y="50%" animatefromx="800">
    <line fontsize="32" fontstyle="bold"  text="Screen FOURRRR!"/>
   </text>
  </screen>

 </slideshow>
</data>
XML;

$matches = null;
preg_match_all('#<[^>]+("([^%>"]*%([^%>"]+)%[^%>"]*)+"|\'([^%>\']*%([^%>\']+)%[^%>\']*)+\')[^>]*>#i', $xml, $matches);

print_r($matches);
?>

¡Gracias! :)

Respuestas a la pregunta(2)

Su respuesta a la pregunta