I have the following string in the smarty (php templating system) variable $test:
<img height="113" width="150" alt="Sunset" src="/test.jpg"/>
I want to add "em" to the height and width like this:
{$test|replace:'" w':'em" w'|replace:'" a':'em" a'}
But this doesn't work... What's the problem and the solution?
my regex isn't the greatest, or i'd give you a better matcher, but maybe using what you have through the regex replace would work.
{$test|regex_replace:'/".w/':'em" w'|regex_replace:'/".a/':'em" a'}
other matchers to try
'/\".w/'
'/".*w/'
'/\".*w/'
i can't play with my smarty sites at the moment, but i'd first remove the " from the replacement value, to see if the bug is there, then remove it from the matcher and just look for height/width.
otherwise i'd do the replace in PHP if you can.