Samn has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to strip HTML image tags with a regex, the image tags will necessarily not have alt tags, size or double quotes. The code I'm using is
$body =~ s/\<img src=(.*)\>/\[image:\<a href=$1\>$1\<\/a\>\]/gi;
The goal is to change
which would display as a graphic to
[image: <a href=http://fuzzy.com/kittens.jpg>http://fuzzy.com/kittens.jpg</a>]
which displays as text with a hyperlink. My regex is not working if there are two images in a string, however. I'm not exactly sure why, but I suspect it's encapsulating the first opening image tag and the last closing image tag bits. Any suggestions?