in reply to regex is not working properly
s/(?<=[\/"]logo-)([^\/"]*)(?=\.gif")/$cloneName/
A more generic approach, for example if you're not absolutely sure the HTML is formatted the way you want it, or if you parse more than just a snippet, might be to properly parse the tag, and replace individual attributes. That parser can be done with regexes, the html validator on Perlmonks works this way. It's just replacing text in html, without any regard for in what kind of syntactic construct (inside tag, attribute, comment, or plain character data) it's in, that is not safe.
But getting it to work using HTML::TokeParser::Simple just might be easier. You just pass the stuff you don't want to change, in a token parsing loop, using $token->as_is().
|
|---|