How to change html

I’m updating my mail parser and want to embed the data from images into the html. Let’s say I have a nice marketing mail with an embedded image:

<a href=3D"http://stacksocial.us2.list-manage2.com/track/click?u=3D820=
c8324c8d125df5a73a0bb3&id=3D11dce42c08&e=3D7b0ab6f420"><img alt=3D"" clas=
s=3D"test-email-main-image" src=3D"https://image-assets.stackcommerce.com/=
uploaded_screenshot_1s/6612/email_Afterburner-mf-1_1208.jpg" style=3D"padd=
ing-top: 15px; padding-bottom: 20px;" width=3D"600">

The image tag has a link to

https://image-assets.stackcommerce.com/publishers/60/macbundler_email.jpg

Getting the data for the link is no problem. But how do I get the image tag without using regex? The html from mails can be really screwed up. Using TidyMBS I can get the correct image node just fine. But TidyMBS doesn’t allow changing the html.

What can I use instead? Convert the html to xml and then change the xml? As usual I only need a solution for the Mac and plugin solutions are welcome.

You can use instr() on src=" and from that start position look for the second double quote to get the end position. Then you get the URL with a Mid().

why no regex ?

Regex is a pain in the behind and rather brittle. Here I think it will be okay as I just need to replace one part of a tag.