Hi,
Thanks for your help !
The only issue I see is if you had .* you could match strange case !
What do you think of [^<]* instead ?
Thanks
Does not work for me – I’ve a got a lot of
“
<img class=”alignnone size-medium wp-image-203″ style=”float: left; margin-right: 18px;” title=”KonvoyT-K” src=”http://www.bgudkov.ru/wp-content/uploads/2011/05/KonvoyT-K-300×97.png” alt=”т” width=”300″ height=”97″ />” style links with
between <a and <img.
We have ungreedy regexp here, so something can go wrong if there is a and no <img after it eventually. Otherwise the first <img will match
Also
$pattern = ‘/(<a([^>]*?)href=”([^”]*\.)’.$this->image_type.'”([^>]*?)>.*<img([^>]*?)src=”([^”]*\.)’.$this->image_type.'”([^>]*?)\><\/a>)/iesU’;
with \. before extensions seems better so that images like “imagepng” without dot are ignored
Hum … ok for the \. issue
I still does not understand why the [^<]* does not work in your case… We should accept anything between the tag and the <img> tag except an another tag no ?
ahhh… i looked at the HTML code of this page and i understood …
there is br tag
What do you think of ([^<]|<br)*
arf … the forum convert my < ; and > ; into html code !!!
People – please post code and markup snippets in between backticks or use the code button.
The final regex will be :
$pattern = '/(<a([^>]*?)href="([^"]*[.])'.$this->image_type.'"([^>]*?)>([^<]|<br)*<img([^>]*?)src="([^"]*[.])'.$this->image_type.'"([^>]*?)\>([^<]|<br)*<\/a>)/iesU';
Are you agree ? If so I will release a new version
and
$replacement = 'stripslashes("<a\2href=\"\3\4\" class=\"highslide\" onclick=\"return hs.expand(this , { maxWidth: '.$this->get_param('widthRestriction').', maxHeight: '.$this->get_param('heightRestriction').', autoplay: '.$autostart.' });\"\5>\6<img\7src=\"\8\9\" \10>\11</a>")';
Well, it seems that it works, though <br seems a little bit like workaround )))
Yes it is … 🙂
A new version has been released, thus I mark this subject as solved