I'm trying to save helper strings (kind of like Stack's [enter link description here][1]
) to the database and compile them as HTML when retrieved/viewed. A sample text is:
var str = 'This is just a sample text followed by an {{image: imageUrl1}}. And here is another {{image: imageUrl2}}.';
I tried the following RegEx:
str.match(`/(\{\{image:)[^(.*\}\})]*.*(\}\})/g`);
But I just get ["{{image: imageUrl1}}. And here is another {{image: imageUrl2}}"]
.
What should be the RegEx pattern so that the result is ["{{image: imageUrl1}}", "{{image: imageUrl2}}"]
?