i want to replace all my images (with an own special attribute)
<img width="720" height="321" dl="text-text-text-text" alt="Marl's Palace of Sin" src="/images/sin-ambiente.jpg" title="Innenansichten des Hauses">
into this
<dl class="imgLeft">
<dt>
<img width="720" height="321" alt="Marl's Palace of Sin" src="/images/sin-ambiente.jpg" title="Innenansichten des Hauses">
</dt>
<dd>text-text-text-text</dd>
</dl>
my php function
function dlSytler($htmlContent)
{
$regex = '#<img([^>]*).*dl="([^"/]*/?[^".]*\.[^"]*)"([^>]*).*>#';
$replace = '<dl class="imgLeft"><dt><img$1 $3> </dt> <dd>$2</dd> </dl>';
$htmlContent = preg_replace($regex, $replace, $htmlContent);
return $htmlContent;
}
the problem is, that the replace doesnt work an every image (and i dont know why).
I think my regex-rule is not perfect. Can anybody help me?