I needed to manipulate some text output from JS function, to do that we need to create DOM element from that output. So what you can do is
var wrapper= document.createElement('div');
wrapper.innerHTML= matches[key];
var div_article= wrapper.getElementsByTagName("article");
which will create dummy element, add some innetHtml to it and then from it you can extract exact element you want, like I wanted element with article tag, so this is what I got and I could use it from then as DOM element and find a particular value from it, which was
div_article[0].dataset.tag