You could do it with a RegEx expression, but as these are not very easy to use here is a helper library:
I don't like Regex...[
^]
This way you can extract e.g. the width with a pattern like "width =\"*\""
Another simple idea is to use a placeholder that you can easily replace with a string, something like this:
width ="{mywidth}" height="{myheight}"