Remove everything except substrings in string

Hi,

I’d like to be able to remove everything in a String EXCEPT predefined substrings, so something like;

var substring1 = "<bullet>"
var substring2 = "<img>"

var myString = "<bullet><img>some text<bullet><img>some more text <img>"

Some function which would return myString as “<bullet><img><bullet><img><img>”

Have tried split and join to remove or replace substring, but not to keep them but remove all other characters.