I created a regex to parse the src-attribute (hosting the images now on cloudfront) and alt-attribute from images. I'm substituting them to turn them into Markdown.
Some are embedded into an attribute. I created an optional group for the surrounding (<a href.*)?
Since I use backreferences to create my Markdown I don't want these optional groups to be captured.
How can I do this?
This is my regex:
/(<a href.*)?<img.*?src="http:\/\/www.example.com\/uploads(.*?)" alt="(.*?)".*?\/?>(<\/a>)?/gm
This is my substituion:
