in reply to Why doesn't non-greediness work?

I think what you're after is something like this:
my $body = qq!<img border="0" src="/images/wink.gif" alt="Wink"> <img +border="0" src="/images/smiley.gif" alt="Smiley">!; %replacer = ( "Smiley" => ":)", "Wink" => ";)" ); $body =~ s/<img(?:.+?)="(Smiley|Wink)">/$replacer{$1}/g; print "$body\n";
which prints: ";) :)" -- note that it uses "(?:.+?)" to cluster, not capture, the irrelevant characters that precede the "=".