I am creating a component for a CMS that runs a find/replace on the response of text input, it should replace any instances of [html_image url="example"] with
I have managed to create a simple string.replace that successfully replaces a single instance (my regex is an exact match), however, I am looking for a little help refactoring my regex to find ALL instances.
article.content = "this is an image, {html_image id=222}. This is also an image {html_image id=111}
article.content = article.content.replace(
new RegExp('{html_image id=222}'),
'<img src="" />'
);
current output = "this is an image, <img src="222"/>. This is also an image {html_image id=111}"
expected output = "this is an image, <img src="222"/>. This is also an image <img src="111"/"
new RegExp('{html_image id=222}', 'g')add theglobaltag with your regex